An AI-assisted DJ prototyping platform that listens to crowd energy, searches and enriches tracks with Spotify metadata, analyzes local audio files, and recommends smoother next-track transitions in a live browser dashboard.
Resonance: Tunin In is built as an end-to-end demo of a feedback loop for intelligent DJ support: crowd signal in, track intelligence out.
This project combines a Python backend with a browser-based frontend to simulate how an AI DJ assistant could react to a room in real time.
The system can:
- monitor live microphone input from the browser
- estimate crowd energy from incoming audio chunks
- search Spotify tracks and enrich them with tempo, key, energy, and danceability
- suggest a next track based on harmonic compatibility, BPM proximity, and crowd state
- browse genre lanes automatically depending on whether the room feels low, building, or peak
- analyze local audio files for BPM, beat activity, RMS, onset rate, and spectral motion
- preview Spotify clips directly in the UI
The result is a practical experimental dashboard for testing crowd-reactive recommendation logic rather than a full production DJ engine.
The frontend can stream microphone audio to the backend over WebSockets. The backend analyzes incoming chunks and returns live energy metrics such as:
- RMS
- onset rate
- spectral flux
- inferred crowd state (
low,building, orpeak)
These values are visualized in real time in the browser.
Search results are pulled from Spotify and enriched with musical metadata including:
- BPM / tempo
- musical key
- mode
- Camelot notation
- energy
- danceability
- preview URL when available
This gives the recommendation engine enough structure to make safer transition choices.
Instead of only searching manually, the app can browse multiple genres based on the current crowd state.
Default lane behavior:
low: calmer or reset-friendly genresbuilding: genres with more lift and motionpeak: higher-pressure genres for peak-time energy
You can also supply your own custom genre mix and optionally enable auto re-browse when the crowd state changes.
The recommendation engine scores candidate tracks using a combination of:
- harmonic compatibility
- BPM proximity
- energy matching
- danceability
- artist continuity or variety
- preview availability
It then selects a strong follow-up candidate and explains why it was chosen.
The app can analyze a local audio file path and estimate:
- BPM
- beat count
- first beat offset
- RMS
- onset rate
- spectral flux
- duration
That analysis can be merged into the current track or added to the working library as a locally analyzed track.
The frontend provides a compact control surface for:
- connecting to the backend
- starting and stopping microphone capture
- simulating demo energy pulses
- searching Spotify
- browsing AI-selected genres
- previewing tracks
- selecting a current deck
- promoting a recommended next track
- scanning local audio files
- FastAPI
- Uvicorn
- WebSockets
- Spotipy
- python-dotenv
- librosa
- NumPy
- SciPy
- HTML
- CSS
- Vanilla JavaScript
- Web Audio API
- native WebSocket API
- The browser connects to the FastAPI backend over WebSocket.
- Microphone audio is captured in the frontend and sent as sample arrays.
- The backend computes crowd-energy metrics and classifies the room state.
- The frontend uses that state to drive AI genre browsing and recommendation behavior.
- Spotify search results are enriched with audio features.
- The track selector scores available tracks and recommends a follow-up.
- Local audio analysis can supplement or extend the track library.
DJ AI/
├── backend/
│ ├── api/
│ │ ├── server.py
│ │ └── spotify_client.py
│ ├── engine/
│ │ ├── beat_tracker.py
│ │ ├── energy_analyzer.py
│ │ ├── local_track_analyzer.py
│ │ └── track_selector.py
│ ├── main.py
│ ├── requirements.txt
│ └── .env.example
├── frontend/
│ ├── css/
│ ├── js/
│ └── index.html
└── .gitignore
git clone https://github.com/manassanjaymishra24/Resonance-Tunin-In.git
cd Resonance-Tunin-InOn Windows:
cd backend
python -m venv .venv
.venv\Scripts\activatepip install -r requirements.txtCreate a backend/.env file based on backend/.env.example:
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secretYou can obtain these from the Spotify Developer Dashboard.
From the backend folder:
python main.pyThe API will run on:
http://localhost:8000
Open frontend/index.html in your browser.
Then:
- set the WebSocket URL to
ws://localhost:8000/wsif needed - click
Connect - start the mic or simulate energy
- search Spotify tracks or use AI Browse
- set a current track and request a recommendation
GET /health
Returns a simple backend status response.
POST /analyze/local
Example request body:
{
"audio_path": "C:\\Users\\Lenovo\\Music\\track.mp3"
}/ws
Supported message types include:
audio_chunksearchselect_nextai_browse
The track selector is designed to prefer transitions that feel musically safer and context-aware.
It uses:
- Camelot compatibility when key information is available
- BPM distance thresholds
- crowd-state energy targets
- danceability weighting
- slight random variation to avoid identical choices every time
If strong harmonic matches are unavailable, the selector gracefully falls back to broader tempo-safe candidates.
This project is a prototype and assumes:
- valid Spotify API credentials
- a browser with microphone permissions
- local file paths that the backend machine can access
- Python audio-analysis dependencies installed successfully
Some audio libraries can be platform-sensitive depending on your Python setup.
Resonance: Tunin In is currently a demo/research project focused on recommendation and interaction flow. It is not yet a production-ready DJ performance system.
It does not currently include:
- full deck syncing
- live beatmatched playback between tracks
- waveform editing
- playlist persistence
- authentication
- deployment configuration
- production hardening
This project explores a compelling intersection of:
- music intelligence
- crowd-reactive systems
- real-time browser interaction
- recommendation logic
- AI-assisted DJ tooling
It demonstrates how lightweight live signals and track metadata can be combined into a more adaptive DJ-assist experience.
Potential next steps include:
- richer crowd-state modeling
- persistent playlists and session history
- improved transition scoring
- waveform and beat-grid visualization
- direct Spotify playback integration
- deployment with a hosted frontend and backend
- stronger error handling and test coverage
Built by Manas Mishra