DJ Set Reproducer

A 5-stage audio analysis pipeline that reverse-engineers DJ sets into accurate tracklists with timestamps and transition analysis.

Repository: https://huggingface.co/rikhoffbauer2/dj-reproducer

πŸš€ Gradio UI

This repository includes a Gradio app (app.py) for interactive use. To run it:

pip install -r requirements.txt
python app.py

Or deploy as a Hugging Face Space:

  1. Go to https://huggingface.co/new-space
  2. Select Gradio SDK
  3. Clone this repo's files into it
  4. Add system packages: ffmpeg, libchromaprint-tools, libsndfile1

Pipeline Overview

Stage Purpose Output
1 Fingerprint DJ set every ~30s, identify songs via AcoustID stage1_fingerprints.json
2 Download identified songs from YouTube, confirm identity downloads/ + stage2_confirmed.json
3 Align original songs with DJ set to find which part is used stage3_alignments.json
4 Detect transitions (cue-out β†’ cue-in) using DTW path analysis stage4_transitions.json
5 Analyze transition techniques (cut, crossfade, EQ, etc.) stage5_analysis.json
β€” Generate final tracklist tracklist_final.json + tracklist.txt

Installation

# Clone repository
git clone https://huggingface.co/rikhoffbauer2/dj-reproducer
cd dj-reproducer

# System dependencies (Ubuntu/Debian)
sudo apt-get install -y libchromaprint-tools ffmpeg libsndfile1

# macOS
brew install chromaprint ffmpeg

# Python dependencies
pip install -r requirements.txt

Prerequisites

Usage

Full Pipeline (CLI)

python -m dj_reproducer.cli process \
    --input "my_dj_set.mp3" \
    --output-dir ./results \
    --acoustid-key YOUR_ACOUSTID_KEY

Individual Stages (CLI)

python -m dj_reproducer.cli stage1 --input set.mp3 --acoustid-key KEY
python -m dj_reproducer.cli stage2 --tracklist results/stage1_tracklist_raw.json --acoustid-key KEY
python -m dj_reproducer.cli stage3 --input set.mp3 --confirmed results/stage2_confirmed.json
python -m dj_reproducer.cli stage4 --input set.mp3 --alignments results/stage3_alignments.json
python -m dj_reproducer.cli stage5 --input set.mp3 --transitions results/stage4_transitions.json --alignments results/stage3_alignments.json

Gradio UI

python app.py

Then open http://localhost:7860 in your browser.

Algorithm Details

Stage 1: Fingerprinting

  • Window strategy: 30s windows with 25s hop (5s overlap) for redundancy
  • Pipeline: ffmpeg slice β†’ fpcalc chromaprint β†’ AcoustID lookup
  • Rate limiting: 0.35s delay between requests (AcoustID free tier: 3 req/s)
  • Consolidation: Merge overlapping windows of same track into contiguous segments

Stage 3: Alignment (ISMIR 2020 validated)

  • Features: Beat-synchronous CENS chroma
  • Coarse alignment: Chroma cross-correlation (O(n) speed)
  • Refinement: Subsequence DTW (librosa.sequence.dtw(subseq=True)) on Β±30s window
  • Key invariance: All 12 circular chroma shifts tried
  • Validation: Match rate β‰₯0.4 threshold from Serra et al. ISMIR 2020

Stage 4: Transition Detection

  • Method: 32-beat rolling window of diagonal DTW moves
  • cue-out: Last beat where preceding 32 beats are mostly diagonal (>0.8)
  • cue-in: First beat where succeeding 32 beats are mostly diagonal
  • Insight: DJs cluster transitions at 32-beat phrase boundaries

Stage 5: Technique Classification

  • crossfade: RMS slopes show outgoing decreasing + incoming increasing
  • cut: Abrupt RMS jump (>0.5) with low correlation to sum of originals
  • eq_filter: Spectral centroid drops significantly during transition
  • overlay: High correlation between mix and sum of original tracks

Data Contracts

Each stage reads/writes JSON files:

File Schema
stage1_fingerprints.json {timestamp: {offset_seconds, duration_seconds, fingerprint, acoustid_results}}
stage1_tracklist_raw.json {track_id: {title, artist, mbid, start_seconds, end_seconds, confidence}}
stage2_confirmed.json {track_id: {title, artist, youtube_url, download_path, confirmed}}
stage3_alignments.json {track_id: {offset_seconds, confidence, key_shift_semitones, beat_frames_mix, beat_frames_ref}}
stage4_transitions.json [{track_id, title, artist, type: cue_out/cue_in, timestamp_seconds, diagonal_ratio}]
stage5_analysis.json [{timestamp_seconds, outgoing_track, incoming_track, technique, confidence, ...}]
tracklist_final.json {tracks: [{number, artist, title, start, end, start_seconds, end_seconds, key_shift, transition_technique}]}
tracklist.txt Human-readable plain text tracklist

Project Structure

dj_reproducer/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ stage1_fingerprint.py   # Windowed fpcalc + AcoustID lookup
β”œβ”€β”€ stage2_acquire.py     # yt-dlp download + confirmation
β”œβ”€β”€ stage3_align.py       # Beat-sync CENS chroma + subsequence DTW
β”œβ”€β”€ stage4_transitions.py # 32-beat rolling diagonal detection
β”œβ”€β”€ stage5_analyze.py     # RMS/spectral comparison for technique classification
└── cli.py                # Orchestration CLI
app.py                      # Gradio UI
requirements.txt
README.md

References

License

MIT License β€” See repository for details.

Generated by ML Intern

This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Paper for rikhoffbauer2/dj-reproducer