CLI toolkit for searching, recognizing and downloading music.
Project description
MusicRecon ๐ต
Advanced Audio Recognition & Music Discovery Tool
MusicRecon is a powerful command-line tool that identifies songs from audio recordings, searches your music history, and downloads recognized tracks from YouTube. Think Shazam meets YouTube-DL in a robust, feature-packed Python package.
๐ Features
๐ค Real-time Audio Recognition
- Record audio directly from your microphone
- Identify songs using ACRCloud's advanced audio fingerprinting
- Support for various audio formats (WAV, MP3, FLAC, etc.)
๐ File-based Recognition
- Analyze existing audio files
- Automatic audio trimming for optimal recognition
- Batch processing capabilities
๐พ Smart Download System
- Download identified songs from YouTube
- Audio-only or video downloads
- Multiple quality presets
- Robust format fallback system
๐ Search History
- Persistent search history storage
- View previous recognitions
- JSON-based history format
๐ Technical Excellence
- Resilient error handling and retry mechanisms
- Comprehensive logging with colored output
- Modular, extensible architecture
- Cross-platform compatibility
๐ฆ Installation
Prerequisites
- Python 3.8 or higher
- FFmpeg (for audio processing)
Install FFmpeg
Ubuntu/Debian:
sudo apt update && sudo apt install ffmpeg
macOS:
brew install ffmpeg
Windows: Download from FFmpeg official website and add to PATH.
Install MusicRecon
Option 1: Install from PyPI (Coming Soon)
pip install MusicRecon
Option 2: Install from Source
git clone https://github.com/skye-cyber/MusicRecon.git
cd MusicRecon
pip install -e .
Option 3: Manual Installation
pip install requests sounddevice wavio youtube-dl pydub colorama
๐ Quick Start
Basic Usage
Record and identify a song:
musicrecon --record
Identify from audio file:
musicrecon --search path/to/audio.wav
Identify and download:
musicrecon --search song.wav --download
Download specific song:
musicrecon --download "Coldplay - Adventure Of A Lifetime"
Advanced Usage
Record 15 seconds and download as video:
musicrecon --record --duration 15 --download --video --quality high
Show search history:
musicrecon --history
Verbose logging:
musicrecon --record --verbose
๐ Usage Examples
# Simple recording and identification
musicrecon -r
# Identify from file and download audio
musicrecon -s recording.wav -D
# Download specific song as high-quality video
musicrecon -D "Artist - Song Name" -v -q high
# Record 20 seconds and download medium quality video
musicrecon -r -d 20 -D -v -q medium
# View last 10 searches
musicrecon -H
๐ System Architecture
graph TB
A[CLI Interface] --> B[EnhancedShazam]
B --> C[AudioProcessor]
B --> D[ACRCloudRecognizer]
B --> E[YouTubeDownloader]
B --> F[SearchHistory]
C --> C1[Record Audio]
C --> C2[Trim Audio]
C --> C3[Get Duration]
D --> D1[API Communication]
D --> D2[Signature Generation]
D --> D3[Response Parsing]
E --> E1[Format Detection]
E --> E2[Adaptive Download]
E --> E3[Fallback Handling]
F --> F1[Save Search]
F --> F2[Read History]
style B fill:#e1f5fe
style D fill:#f3e5f5
style E fill:#e8f5e8
๐ง How It Works
sequenceDiagram
participant User
participant CLI as MusicRecon CLI
participant Audio as AudioProcessor
participant ACR as ACRCloud
participant YT as YouTubeDownloader
participant History as SearchHistory
User->>CLI: musicrecon --record --download
CLI->>Audio: record_audio()
Audio->>CLI: recording.wav
CLI->>ACR: recognize_song(recording.wav)
ACR->>CLI: Song metadata
CLI->>History: save_search(metadata)
CLI->>YT: download_song(metadata)
YT->>YT: Adaptive format selection
YT->>CLI: Download success
CLI->>User: Song identified & downloaded
โ๏ธ Configuration
ACRCloud API Setup
MusicRecon uses ACRCloud for audio recognition. You'll need to:
- Sign up at ACRCloud
- Create an audio recognition project
- Get your Access Key and Secret
- Update the credentials in
super_shazam.py:
self.recognizer = ACRCloudRecognizer(
access_key='YOUR_ACCESS_KEY',
access_secret='YOUR_ACCESS_SECRET',
region_url='https://identify-eu-west-1.acrcloud.com/v1/identify'
)
File Structure
โโโ musicrecon
โย ย โโโ audio_processor.py
โย ย โโโ cli.py
โย ย โโโ config.py
โย ย โโโ downloader.py
โย ย โโโ history_manager.py
โย ย โโโ __init__.py
โย ย โโโ recognizer.py
โย ย โโโ super_shazam.py
๐ Download Process
flowchart TD
A[Start Download] --> B[Query YouTube]
B --> C{Format Available?}
C -->|Yes| D[Download Preferred Format]
C -->|No| E[Try Fallback Format]
E --> F{Download Success?}
F -->|Yes| G[Download Complete]
F -->|No| H[Next Fallback Strategy]
H --> E
D --> G
E --> I[All Strategies Failed]
I --> J[Report Error]
๐ฏ Command Reference
Global Options
--verbose, -V: Enable debug logging--history, -H: Show search history
Recognition Options
--record, -r: Record audio from microphone--search, -s PATH: Analyze audio file--duration, -d SECONDS: Recording duration (default: 10)
Download Options
--download, -D [QUERY]: Download song (optional specific query)--video, -v: Download video instead of audio--quality, -q LEVEL: Video quality (best/high/medium/low)
๐ Troubleshooting
Common Issues
"Requested format is not available"
- MusicRecon automatically tries fallback formats
- Use
--quality mediumfor more compatible formats - The tool includes robust format detection
"No result" from ACRCloud
- Ensure audio is clear and has sufficient volume
- Try recording longer samples (15-20 seconds)
- Check your ACRCloud API credentials
FFmpeg not found
- Install FFmpeg system-wide
- Ensure it's in your system PATH
Microphone access denied
- Grant microphone permissions to your terminal
- On macOS: System Preferences > Security & Privacy > Privacy > Microphone
Debug Mode
Enable verbose logging to see detailed process information:
musicrecon --record --download --verbose
๐ Output Examples
Successful Recognition
- INFO - Recording 10 seconds of audio...
- INFO - Recording saved to: recording.wav
- INFO - Identifying song...
๐ต Found: Blinding Lights by The Weeknd
- INFO - Downloading: The Weeknd Blinding Lights
- INFO - Download completed successfully!
Search History
- INFO - Last 5 searches:
2024-01-15T14:30:45: Blinding Lights - The Weeknd
2024-01-15T14:28:12: Dance Monkey - Tones and I
2024-01-15T14:25:33: Shape of You - Ed Sheeran
๐ฎ Future Enhanceances
- Spotify/Apple Music integration
- Batch file processing
- GUI interface
- Playlist generation
- Music recommendation engine
- Cloud synchronization
- API server mode
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- ACRCloud for audio recognition API
- yt-dlp for YouTube downloads
- pydub for audio processing
- sounddevice for audio recording
๐ Support
If you encounter any problems or have questions:
- Check the troubleshooting section
- Search existing GitHub Issues
- Create a new issue with detailed information
MusicRecon - Your intelligent audio companion ๐ถ
Identify, Discover, Download
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file musicrecon-1.0.3.tar.gz.
File metadata
- Download URL: musicrecon-1.0.3.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Kali GNU/Linux","version":"2025.4","id":"kali-rolling","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b102dcc37e2fe6932573cb7c78b7c92782db616c44ba1acafc21375079497b5
|
|
| MD5 |
1b129de17751d601f548dc5ab813e0be
|
|
| BLAKE2b-256 |
562933d3e11eaf2273daaba0d1c8f53515aed39113a8521d9bcb5faf8c2416a6
|
File details
Details for the file musicrecon-1.0.3-py3-none-any.whl.
File metadata
- Download URL: musicrecon-1.0.3-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Kali GNU/Linux","version":"2025.4","id":"kali-rolling","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79753edde04be8ee2e8fb99db845a35c6b3f29a7b17702cc7e7be53bb2a45e8c
|
|
| MD5 |
5d1bc06bac0c05931f439795216ab16e
|
|
| BLAKE2b-256 |
c6fb69bf7860751396b092f7186c40a405e286271bfd921fd33b3755740111ed
|