This project implements an end-to-end music recommendation system that relies purely on audio signal analysis, without using any metadata (tags, genres, artists).
Conventional recommenders use collaborative filtering (user behavior) or metadata tags. This system uses Content-Based Filtering on the raw audio:
- DSP Features: Extracts "classical" music theory features like Tempo, Key (Chroma), Timbre (MFCCs), and Energy using
librosa. - Deep Embeddings: Uses a Convolutional Neural Network (CNN) on Mel Spectrograms to learn abstract features.
- Unified Embedding: Combines both vectors into a robust "Song Fingerprint".
- Explainability: Recommends songs and explains why (e.g., "Similar Tempo", "Harmonic Similarity") by analyzing the feature distances.
ai-music-recommendation/
│
├── data/ # (Gitignored) Audio storage
│ ├── raw/ # Place .wav/.mp3 files here
│ └── embeddings/ # Persistent FAISS index
│
├── src/
│ ├── features/ # Feature extraction logic (DSP + Deep)
│ ├── models/ # Embedding orchestration & Recommender Engine
│ ├── preprocessing/ # Loading, Resampling, Normalization
│ └── explainability/ # "Why this song?" logic
│
├── app/
│ ├── api.py # FastAPI Backend
│ └── recommender_ui.py # Streamlit Dashboard
│
└── notebooks/ # Analysis & Visualization
pip install -r requirements.txtThe easiest way to use the system is the Streamlit UI.
streamlit run app/recommender_ui.py- Sidebar: Click "Re-Index Data Folder" to process any audio files in
data/raw. - Main: Upload a song to find similar songs in the database.
For production use or integration:
uvicorn app.api:app --reloadDocs available at: http://localhost:8000/docs
Explore the logic step-by-step:
notebooks/01_audio_explore.ipynb: Visualizing waveforms/spectrograms.notebooks/02_feature_extraction.ipynb: Seeing the extraction of MFCCs/Embeddings.
See src/utils/config.py to adjust:
SAMPLE_RATE: Default 22050 HzDURATION: Default 30s analysis windowVECTOR_DIMENSION: Size of the combined embedding
- Tag-Free: Works on unknown/new music.
- Explainable: "Matches based on: Similar Tempo (120 BPM), Similar Energy".
- Hybrid Vector: Combines interpretable DSP physics with Deep Learning intuition.
- Scalable: Uses FAISS for sub-millisecond similarity search.