Back to projects
#04Mar 20265 min read

Music Recognizer

AI-powered music recognition tool that identifies tracks from audio samples.

PythonAIAudio
CursorClaude

The Problem

You're listening to a DJ set on YouTube. A track drops and you think "what is this?" By the time you pause, open Shazam on your phone, and hold it to the speaker -- the track has changed.

I wanted something that runs in the background, listens to whatever my computer is playing, and automatically identifies every track. No manual intervention.

How It Works

The system captures audio directly from the sound card using WASAPI loopback -- a Windows API that lets you record whatever is coming out of the speakers, including audio routed through Bluetooth headphones. Every few seconds it grabs a short audio chunk and sends it to Shazam's recognition API.

Audio Fingerprinting

Each audio chunk gets processed through Shazam's algorithm:

  1. 01Convert raw audio to WAV format
  2. 02Generate a spectral fingerprint of the audio
  3. 03Send the fingerprint to Shazam's servers
  4. 04Get back track metadata: title, artist, album, and streaming links

Smart Deduplication

When you're listening to a 7-minute track, the recognizer identifies it multiple times. I use a pending/confirmed system:

  • First recognition -- mark as "pending"
  • Second recognition of the same track -- mark as "confirmed" and save
  • Different track recognized -- discard pending, start new

This eliminates false positives and avoids duplicates.

Storage & Export

Confirmed tracks go into a SQLite database with links to Spotify, SoundCloud, and YouTube Music. The entire library can be exported to Excel.

Set Analyzer

The standout feature. Give it a YouTube URL of a DJ set, and it:

  1. 01Downloads the audio using yt-dlp
  2. 02Splits it into overlapping segments
  3. 03Runs Shazam on each segment
  4. 04Outputs a timestamped tracklist

I've used this to create tracklists for sets that have no tracklist posted online.

The Interface

A minimal Tkinter GUI with a dark theme:

  • Real-time display of the currently playing track
  • Full history with clickable streaming links
  • System tray integration -- runs quietly in the background
  • Windows toast notifications when a new track is identified

Tech Stack

  • Python -- core language
  • PyAudioWPatch -- WASAPI loopback audio capture
  • ShazamAPI -- audio fingerprinting (no API key needed)
  • SQLite -- local track database
  • yt-dlp -- YouTube audio download for Set Analyzer
  • pystray + Tkinter -- GUI and system tray
  • win10toast -- Windows notifications

Stats

After a month of daily use, the recognizer has logged 331 unique tracks -- primarily deep house, afro house, melodic techno, and progressive. The most recognized artist? Da Africa Deep. The man is everywhere.

All 331 tracks are now playable directly on this website via the native music player.

No track playing

331 tracks available

Queue · 0 tracks