Skip to content

Repository files navigation

DSP Audio Fingerprinting & Recognition System

DSP Audio Fingerprinting & Recognition System is an industrial-strength audio fingerprinting and recognition system built with Django, Elasticsearch, and PostgreSQL. It works similarly to Shazam, allowing users to identify songs by recording a short audio snippet or uploading an audio file.

Core DSP Techniques

This project implements the core digital signal processing (DSP) algorithms described by Avery Li-Chun Wang in his seminal 2003 paper for Shazam.

1. Spectrogram Generation

The raw audio signal is first converted to mono and downsampled (e.g., 22050 Hz). A Short-Time Fourier Transform (STFT) is applied over sliding overlapping windows to compute a Mel-scaled spectrogram, transforming the time-domain audio into a time-frequency representation.

2. Peak Picking & Constellation Map

The system analyzes the spectrogram to find "peaks"—local maxima of amplitude that represent the most prominent frequencies at any given time. By filtering out background noise and retaining only these high-energy peaks, the system generates a sparse, noise-resistant Constellation Map.

3. Combinatorial Hashing & Target Zones

To achieve robustness against time-shifting and distortion, the system pairs peaks together. Each peak acts as an "anchor point" and is paired with several subsequent peaks within a predefined "target zone" (a specific time/frequency window). For each pair, a hash is generated: Hash(Freq_Anchor, Freq_Target, Time_Delta). This hash is completely invariant to the absolute time the song started, making it perfect for identifying random audio snippets.

4. Matching & Alignment

During a search query, the snippet's constellation hashes are matched against the database. The system calculates the time difference (Time_Offset = DB_Time - Query_Time) for each matching hash. If a large cluster of hashes shares the exact same Time_Offset, it indicates a strong temporal alignment, confirming a true match.

Citation

The core fingerprinting algorithm is based on:

Wang, Avery Li-Chun. "An Industrial-Strength Audio Search Algorithm." ISMIR. Vol. 2003. 2003.
Link to Paper (Columbia University)


Setup and Replication

You can easily replicate and run this system locally using Docker and Docker Compose.

Prerequisites

  • Docker & Docker Compose
  • Python 3.9+ (if running locally without Docker)

Running with Docker (Recommended)

  1. Clone the repository

    git clone <repository-url>
    cd <repository-directory>
  2. Start the containers

    docker-compose up -d --build

    This will start the Django web server (Port 8000), PostgreSQL database (Port 5432), and Elasticsearch node (Port 9200).

  3. Apply Database Migrations

    docker-compose exec web python manage.py migrate
  4. Access the Application Open your browser and navigate to: http://localhost:8000/

Running Locally (Without Docker)

  1. Install Dependencies Ensure you have ffmpeg installed on your system (required by librosa).

    pip install -r requirements.txt
  2. Database Setup You need a running instance of PostgreSQL and Elasticsearch (v7.x or v8.x). Ensure your local credentials match the environment variables or configuration files.

  3. Run Migrations & Start Server

    python manage.py migrate
    python manage.py runserver

Populating the Database

To add songs to your database, you can use the provided Django management command:

python manage.py Bulk_add_songs

This script will parse your music library, extract the audio features, generate the constellation map, create combinatorial hashes, and store them efficiently into Elasticsearch for rapid querying.

About

High-performance audio fingerprinting pipeline using advanced digital signal processing (DSP), spectral peak landmarks, and robust geometric hashing.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages