Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

k3ss-official/dj-sample-discovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽง DJ Sample Discovery - SOTA Edition

AI-Powered Track Discovery & Intelligent Sampling Tool

State-of-the-art music structure analysis, harmonic mixing, and 6-stem separation optimized for Apple M4 Mini

Version Python React License


๐Ÿš€ What's New in SOTA Edition

๐ŸŽฏ State-of-the-Art Features

Feature Description
Advanced Structure Analysis Self-similarity matrix-based segmentation detects intro, verse, chorus, breakdown, drop, bridge, outro
Smart Sample Selection AI avoids silence, picks energy peaks, aligns to beat grid, scores loop quality
Full Camelot Wheel 24-key harmonic mixing with compatible key suggestions and energy boost mixing
Mashup Potential Scoring Calculate compatibility between any two samples for mashups
Audio Fingerprinting Chromaprint-inspired similarity detection across your sample library
Semantic Audio Search Find samples by characteristics (bright, percussive, energetic, etc.)
DAW Export Rekordbox XML, Serato crates, M3U playlists with metadata
Beat Quantization Perfect bar-aligned loop points with downbeat detection

โœจ Core Features

๐Ÿ” Track Discovery

  • Search artists via MusicBrainz, Discogs, Spotify APIs
  • Filter by date range (1990-2024)
  • Track type filtering: Original, Remix, Collaboration, Production

๐ŸŽต Intelligent Audio Download

  • Best quality audio via yt-dlp (YouTube Music, SoundCloud, Bandcamp)
  • Automatic source selection
  • 24-bit WAV output format

๐Ÿง  SOTA Structure Analysis

  • Self-similarity matrix segmentation
  • Beat tracking with downbeat detection
  • Section classification: intro, verse, chorus, breakdown, drop, bridge, outro
  • Energy profile mapping
  • Silence detection & avoidance

๐ŸŽน Harmonic Analysis

  • Accurate key detection using Krumhansl-Schmuckler profiles
  • Full Camelot wheel mapping (24 keys)
  • Compatible key suggestions for mixing:
    • Same key (100% match)
    • +1/-1 (smooth transitions)
    • Relative major/minor (mood change)
    • Energy boost (+7 semitones)

๐ŸŽš๏ธ Intelligent Sampling

  • Configurable sample length: 4, 8, 16, 32, 64 bars
  • Section preference (drop, chorus, breakdown, etc.)
  • Score-based sample point ranking:
    • Energy score
    • Beat alignment score
    • Silence avoidance score
    • Loop quality score

๐ŸŽ›๏ธ 6-Stem Separation (Demucs)

  • htdemucs_6s model
  • Stems: drums, bass, vocals, guitar, piano, other
  • Apple M4 MPS acceleration
  • Per-sample or batch processing

๐Ÿ“Š Mashup Potential

  • BPM compatibility analysis
  • Harmonic compatibility scoring
  • Energy level matching
  • Structure complementarity
  • Overall recommendation: Excellent / Good / Possible / Difficult / Avoid

๐Ÿ”Š Audio Fingerprinting

  • Spectral peak extraction
  • Constellation map generation
  • Multi-dimensional similarity scoring
  • Duplicate detection
  • Similar sample finder

๐Ÿ“ DAW Export

  • Rekordbox XML: Full metadata, cue points, colors
  • Serato: CSV and M3U8 for Smart Crates
  • M3U8: Universal playlist format
  • JSON: Complete backup/transfer

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        Electron Desktop                          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  React + TypeScript Frontend                                     โ”‚
โ”‚  โ”œโ”€โ”€ SearchPanel (Artist/Date/Type filters)                     โ”‚
โ”‚  โ”œโ”€โ”€ TrackList (Selection & batch)                              โ”‚
โ”‚  โ”œโ”€โ”€ SOTAPanel (Camelot wheel, structure viz)                   โ”‚
โ”‚  โ”œโ”€โ”€ MashupScorer (Compatibility calculator)                    โ”‚
โ”‚  โ”œโ”€โ”€ SampleCard (Waveform, play/grab/discard)                   โ”‚
โ”‚  โ””โ”€โ”€ ExtractionSettings (Bars, stems, section)                  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Flask + SocketIO Backend (Python)                               โ”‚
โ”‚  โ”œโ”€โ”€ Metadata Service (MusicBrainz, Discogs, Spotify)           โ”‚
โ”‚  โ”œโ”€โ”€ Download Service (yt-dlp multi-source)                     โ”‚
โ”‚  โ”œโ”€โ”€ SOTA Analyzer (Structure, beats, harmony)                  โ”‚
โ”‚  โ”œโ”€โ”€ Sample Extractor (Intelligent point selection)             โ”‚
โ”‚  โ”œโ”€โ”€ Stem Separator (Demucs htdemucs_6s)                        โ”‚
โ”‚  โ”œโ”€โ”€ Harmonic Mixer (Camelot wheel, mashup scoring)             โ”‚
โ”‚  โ”œโ”€โ”€ Audio Fingerprint (Similarity, duplicates)                 โ”‚
โ”‚  โ””โ”€โ”€ DAW Exporter (Rekordbox, Serato, M3U)                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • FFmpeg (for audio processing)

Quick Start

# Clone repository
git clone https://github.com/k3ss-official/dj-sample-discovery.git
cd dj-sample-discovery

# Run setup script
./setup.sh

# Or manual setup:
npm install
cd backend && pip install -r requirements.txt && cd ..

Environment Variables (Optional)

Create .env in backend/ directory:

# Optional API keys for enhanced metadata
SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret
DISCOGS_TOKEN=your_token

# Configuration
DJ_DATA_DIR=~/DJ_Samples
DJ_HOST=127.0.0.1
DJ_PORT=5555
DJ_DEBUG=false

๐Ÿš€ Usage

Start the Application

# Terminal 1: Start Python backend
cd backend
source venv/bin/activate  # If using venv
python server_sota.py

# Terminal 2: Start React frontend
npm run dev

# Access at http://localhost:5173

Or with Electron (Desktop App)

npm run dev  # Starts both backend and Electron app

๐ŸŽฏ Workflow

1. Search

  • Enter artist name
  • Set date range (optional)
  • Filter track types

2. Select

  • Browse discovered tracks
  • Select tracks for sampling
  • Configure extraction settings:
    • Bar count: 4/8/16/32/64
    • Section preference
    • Enable stem separation

3. Extract

  • Watch progress in real-time
  • Automatic download โ†’ analysis โ†’ extraction

4. Review Samples

  • Waveform visualization
  • Play/Stop with Web Audio
  • Camelot key display
  • Compatible keys for mixing
  • Grab (download to folder)
  • Discard (remove sample)

5. Advanced Features

  • Mashup Scorer: Compare any two samples
  • Structure View: See track segments
  • Export: Rekordbox/Serato/M3U

๐Ÿ“Š API Endpoints

SOTA Analysis

POST /api/sota/analyze
POST /api/sota/structure

Harmonic Mixing

GET  /api/harmonic/compatible?key=Am
POST /api/harmonic/mix-score
POST /api/harmonic/mashup-score
POST /api/harmonic/suggest-order

Fingerprinting

POST /api/fingerprint/generate
POST /api/fingerprint/compare
POST /api/fingerprint/find-similar
POST /api/semantic/describe

DAW Export

POST /api/export/rekordbox
POST /api/export/serato
POST /api/export/m3u
POST /api/export/json

๐Ÿ”ง Configuration

Sample Bar Options

SAMPLE_BAR_OPTIONS = [4, 8, 16, 32, 64]
DEFAULT_SAMPLE_BARS = 16

Demucs Settings (M4 Optimized)

DEMUCS_MODEL = 'htdemucs_6s'
DEMUCS_DEVICE = 'mps'  # Apple Silicon GPU
DEMUCS_STEMS = ['drums', 'bass', 'vocals', 'guitar', 'piano', 'other']

Audio Quality

SAMPLE_RATE = 44100
BIT_DEPTH = 24
AUDIO_FORMAT = 'wav'

๐Ÿ“ Project Structure

dj-sample-discovery/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ server_sota.py      # SOTA Flask server
โ”‚   โ”œโ”€โ”€ server.py           # Legacy server
โ”‚   โ”œโ”€โ”€ config.py           # Configuration
โ”‚   โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ”‚   โ””โ”€โ”€ services/
โ”‚       โ”œโ”€โ”€ sota_analyzer.py       # SOTA structure analysis
โ”‚       โ”œโ”€โ”€ harmonic_mixer.py      # Camelot wheel & mashup
โ”‚       โ”œโ”€โ”€ audio_fingerprint.py   # Fingerprinting
โ”‚       โ”œโ”€โ”€ daw_exporter.py        # Rekordbox/Serato
โ”‚       โ”œโ”€โ”€ audio_analyzer.py      # BPM/Key detection
โ”‚       โ”œโ”€โ”€ sample_extractor.py    # Sample extraction
โ”‚       โ”œโ”€โ”€ stem_separator.py      # Demucs integration
โ”‚       โ”œโ”€โ”€ download_service.py    # yt-dlp downloader
โ”‚       โ””โ”€โ”€ metadata_service.py    # API aggregation
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ App.tsx             # Main React app
โ”‚   โ”œโ”€โ”€ main.tsx            # Entry point
โ”‚   โ””โ”€โ”€ components/
โ”‚       โ”œโ”€โ”€ SOTAPanel.tsx          # SOTA features UI
โ”‚       โ”œโ”€โ”€ MashupScorer.tsx       # Mashup calculator
โ”‚       โ”œโ”€โ”€ SearchPanel.tsx        # Artist search
โ”‚       โ”œโ”€โ”€ TrackList.tsx          # Track selection
โ”‚       โ”œโ”€โ”€ SampleCard.tsx         # Sample preview
โ”‚       โ”œโ”€โ”€ Waveform.tsx           # Wavesurfer.js
โ”‚       โ””โ”€โ”€ ExtractionSettings.tsx # Settings panel
โ”œโ”€โ”€ electron/
โ”‚   โ”œโ”€โ”€ main.js             # Electron main process
โ”‚   โ””โ”€โ”€ preload.js          # IPC bridge
โ”œโ”€โ”€ package.json            # NPM dependencies
โ”œโ”€โ”€ setup.sh                # Installation script
โ””โ”€โ”€ README.md               # This file

๐Ÿ› ๏ธ Tech Stack

Backend

  • Python 3.10+
  • Flask + Flask-SocketIO
  • librosa - Audio analysis
  • Demucs - Stem separation
  • yt-dlp - Audio download
  • MusicBrainz/Discogs/Spotify APIs - Metadata

Frontend

  • React 18 + TypeScript
  • Tailwind CSS - Styling
  • wavesurfer.js - Waveform visualization
  • Web Audio API - Audio playback

Desktop

  • Electron 28 - Desktop wrapper

๐Ÿ“ˆ Performance (M4 Mini 16GB)

Operation Time
SOTA Analysis (5min track) ~15 seconds
Sample Extraction ~2 seconds
Stem Separation (6 stems) ~45 seconds
Fingerprint Generation ~3 seconds

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

๐Ÿ“„ License

MIT License - see LICENSE file


๐Ÿ™ Credits

  • Demucs by Facebook Research
  • yt-dlp maintainers
  • librosa for audio analysis
  • MusicBrainz, Discogs, Spotify APIs

๐Ÿ”ฎ Roadmap

  • Real-time audio preview in browser
  • Cloud sync for sample library
  • Ableton/FL Studio export
  • AI-powered "similar artists" discovery
  • Batch stem export
  • Mobile companion app
  • Plugin versions (VST/AU)

Made with โค๏ธ for DJs and Producers

Built for M4 Mini โ€ข Powered by AI โ€ข SOTA Quality

About

AI-powered DJ track discovery and intelligent sampling tool with 6-stem separation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published