Fourio is a command-line implementation of a music recognition system inspired by Shazam.The name Fourio is a portmanteau of "Fourier" and "Audio" named after the Fourier Transform.It analyzes song fingerprints, detects matches from local or downloaded tracks, and integrates with Spotify and YouTube for metadata and previews. It has addtional features like a REST APIs, Multiple DB support like MongoDB and SQLite.
This version of Fourio is fully written in Python, powered by:
- β‘ FastAPI β backend API framework for high-performance web services
- π§ Typer β command-line interface (CLI) for intuitive developer experience
- π§© uv β ultra-fast dependency manager and environment tool
- π΅ ffmpeg β audio conversion and processing utility
- βοΈ Spotify API β metadata integration for tracks, albums, and playlists
- ποΈ YouTube API β for fetching song previews and additional metadata
fourio/
βββ app/
β βββ api/ # Web API endpoints
β βββ utils/ # Logging, file handling, general utilities
β βββ db/ # Database connection and operations
β βββ models/ # Data models
β βββ services/ # Different services like Spotify, YouTube and WAV conversion
β βββ core/ # Core fingerprinting, Spectrogram and matching logic
β βββ main.py # FastAPI entry point
|ββ .env # Environment variables
βββ pyproject.toml # uv dependencies
βββ requirements.txt # Python dependencies (Optional)
βββ cli_logic.py # CLI logic
βββ cli.py # Typer CLI entry point
βββ .gitignore
βββ README.md
βββ LICENSEInstall FFmpeg:
-
Windows (Chocolatey β Recommended)
choco install ffmpeg
-
macOS (Homebrew)
brew install ffmpeg
-
Linux (Ubuntu/Debian)
sudo apt update sudo apt install ffmpeg
Verify installation:
ffmpeg -versionπΉ uv β ultra-fast Python environment & dependency manager
Install guide: https://github.com/astral-sh/uv
# Clone the repo
git clone https://github.com/RudraNarayan94/Fourio.git
cd fourio
# Create virtual environment (using uv)
uv venv
# Install dependencies
uv sync # Clone the repo
git clone https://github.com/RudraNarayan94/Fourio.git
cd fourio
# Create virtual environment (using venv)
python -m venv venv
# Activate it
source venv/bin/activate # macOS/Linux
# On Windows:
# venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate a .env file inside folder.
Use the structure defined in the sample file:
π See .env.example (link)
The .env file should include keys for:
- Spotify API access
- Database configuration
- Backend settings
- YouTube API key (optional)
You can generate Spotify credentials by creating an app at the
π Spotify Developer Dashboard:
https://developer.spotify.com/dashboard/
Once created, copy your:
SPOTIFY_CLIENT_ID=your-client-id
SPOTIFY_CLIENT_SECRET=your-client-secretThese credentials allow Fourio to access track metadata, album details, and playlist information.
Run CLI
uv run python cli.py --help| Command | Description |
|---|---|
find <path_to_audio_file> |
Analyze audio file in any format and find matching fingerprints |
download <spotify_url> |
Download and process a song/album/playlist from Spotify |
save <path_or_dir> [--force/-f] |
Fingerprint and save local songs |
erase |
Clear all stored songs and fingerprints from the database |
| Endpoint | Method | Description |
|---|---|---|
/fourio/match |
POST | Match audio fingerprint against database and return top 10 matches |
/recordings/save |
POST | Save base64-encoded audio recording as WAV file |
/songs/total |
GET | Get total number of indexed songs in database |
/songs/download |
POST | Download and process Spotify track/album/playlist |
uv run python -m uvicorn app.main:app --reloaduv run python cli.py download https://open.spotify.com/track/4pqwGuGu34g8KtfN8LDGZmuv run python cli.py find songs/Voila.mp3uv run python cli.py save ./local_songs/ --forceuv run python cli.py erase- SeekTune - Go implementation of Shazam(main resource)
- How does Shazam work - Coding Geek (main resource)
- Song recognition using audio fingerprinting
- How does Shazam work - Toptal
- Creating Shazam in Java
Fourio have the potential to gradually evolve into a full-stack, Shazam-style system with a modern UI and scalable backend. Feel free to contribute or suggest features!
- Modern UI for song matching & downloads
- Microphone recording & PCM extraction
- Client-side fingerprint generation
- WebSocket for real-time matching
- WEBSOCKETS Endpoints for song processing & matching
- Redis for backend service
- Better DB Schema for fingerprints
- Tunable fingerprint density & thresholds
- Docker setup
- Optional FFmpeg/GPU acceleration
This project is licensed under the MIT License.

