π A Python script that downloads audio from SoundCloud or YouTube, splits it into segments, and uses Shazam to identify songs within the mix.
- π§ Download audio from SoundCloud or YouTube URLs
- πΌ Identify songs using Shazam API
- πΎ Save results to timestamped text files
- π Easy setup and usage with provided shell script
This project uses yt-dlp for downloading audio from SoundCloud and YouTube.
sudo apt install ffmpeg
pip install ShazamApi pydub yt-dlp shazamio
# Install Homebrew if not already installed
# See https://brew.sh for installation instructions
brew install ffmpeg
# Optional: Create and activate virtual environment
# python3.11 -m venv venv && source venv/bin/activate
# If you don't have Python 3.11:
# brew install python@3.11
# Install required packages
pip install shazamio pydub yt-dlp ShazamApi
Use the provided shell script for easy setup and running:
# Make the script executable (if needed)
chmod +x run_shazam.sh
# Setup environment (installs dependencies, creates venv)
./run_shazam.sh setup
# Download and process audio from URL
./run_shazam.sh download <url>
# Process all downloaded files
./run_shazam.sh scan
# Process a specific audio file
./run_shazam.sh recognize <file>
# Show help information
./run_shazam.sh help
The script also supports direct Python invocation with three main commands:
python shazam.py download <url>
Downloads audio from YouTube or SoundCloud and processes it for song recognition.
python shazam.py scan
Processes all MP3 files in the Downloads directory.
python shazam.py recognize <file>
Processes a single audio file for song recognition.
Results are saved in the recognised-lists
directory with timestamped filenames in the format:
songs-DDMMYY-HHMMSS.txt
βΉοΈ The generated song list can be imported into TuneMyMusic
- The script splits audio into 1-minute segments for optimal recognition
- Duplicate songs within the same mix are automatically filtered out
- Large files are processed in chunks to manage memory efficiently
Feel free to open issues or submit pull requests with improvements. We welcome contributions from the community!