Skip to main content

CLI toolkit for searching, recognizing and downloading music.

Project description

MusicRecon ๐ŸŽต

Advanced Audio Recognition & Music Discovery Tool

Python Version License Code Style

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:

  1. Sign up at ACRCloud
  2. Create an audio recognition project
  3. Get your Access Key and Secret
  4. 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 medium for 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.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support

If you encounter any problems or have questions:

  1. Check the troubleshooting section
  2. Search existing GitHub Issues
  3. Create a new issue with detailed information

MusicRecon - Your intelligent audio companion ๐ŸŽถ

Identify, Discover, Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

musicrecon-1.0.3.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

musicrecon-1.0.3-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

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

Hashes for musicrecon-1.0.3.tar.gz
Algorithm Hash digest
SHA256 7b102dcc37e2fe6932573cb7c78b7c92782db616c44ba1acafc21375079497b5
MD5 1b129de17751d601f548dc5ab813e0be
BLAKE2b-256 562933d3e11eaf2273daaba0d1c8f53515aed39113a8521d9bcb5faf8c2416a6

See more details on using hashes here.

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

Hashes for musicrecon-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 79753edde04be8ee2e8fb99db845a35c6b3f29a7b17702cc7e7be53bb2a45e8c
MD5 5d1bc06bac0c05931f439795216ab16e
BLAKE2b-256 c6fb69bf7860751396b092f7186c40a405e286271bfd921fd33b3755740111ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page