explaingit

worldveil/dejavu

6,752PythonAudience · developerComplexity · 3/5Setup · moderate

TLDR

A Python library that fingerprints your music collection and recognizes songs from short audio clips or live microphone input, similar to how music-recognition apps work on a phone.

Mindmap

mindmap
  root((dejavu))
    What it does
      Audio fingerprinting
      Song recognition
      Microphone input
    How it works
      Fingerprint stage
      Match stage
      Database lookup
    Databases
      MySQL
      PostgreSQL
    Setup options
      Docker quickstart
      Manual install
      CLI and Python API
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a tool that identifies a song playing in the background from a short microphone recording.

USE CASE 2

Fingerprint a personal music library and query it to find duplicate or misidentified tracks.

USE CASE 3

Integrate audio fingerprinting into a Python app to auto-tag audio files by matching against known recordings.

Tech stack

PythonMySQLPostgreSQLDocker

Getting it running

Difficulty · moderate Time to first run · 30min

Quickest setup via Docker which includes PostgreSQL, manual install requires system audio libraries and a running database.

In plain English

Dejavu is a Python library that can identify a song by listening to a short clip of it, similar in concept to the way music recognition apps work on a phone. It does this by analyzing audio to create a compact "fingerprint" and storing those fingerprints in a database. When you play an audio clip or hold a microphone up to a speaker, Dejavu compares what it hears against the stored fingerprints and tells you which song matches. The README notes it works well for recognizing exact recordings with background noise, but is not built for voice or speech recognition. The recognition process has two stages. First, you run a fingerprinting step, which processes a folder of audio files and saves their fingerprints to a database (MySQL or PostgreSQL are both supported). This can take time for large collections, but the process is resumable: if you stop and restart it, Dejavu picks up where it left off. Second, you run a recognition step against either a saved audio file or live microphone input. Both a Python API and a command-line interface are available for both stages. Setup is available through Docker for the quickest start, which brings up both the Python environment and a PostgreSQL database together. There is also a manual installation path described in a separate file for people who prefer to configure their own database. The configuration is passed as a plain Python dictionary, which includes the database connection details and a few optional parameters like how many seconds of each song to fingerprint. Adjustable settings in the config file let you tune the tradeoff between recognition speed and accuracy, with documentation on what each parameter does. The README includes test result plots showing how confidence scores and recognition speed change as the fingerprint database grows. The project appears to be in maintenance mode based on the README's age, but the Docker setup and examples remain functional. The README does not specify a license.

Copy-paste prompts

Prompt 1
Using Dejavu, help me write Python code to fingerprint all MP3 files in a folder and store the results in a PostgreSQL database.
Prompt 2
Show me how to use Dejavu to listen to 10 seconds of audio from my microphone and identify the matching song from my fingerprinted library.
Prompt 3
Help me tune Dejavu's fingerprint settings to balance recognition accuracy and speed for a music library of around 5000 songs.
Open on GitHub → Explain another repo

← worldveil on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.