Neuroadaptive Music Recommendation Powered by Brain-Computer Interfaces
Winner - Best Use of Streamlit @ UGAHacks X
Traditional music recommendation systems rely on listening history and genre preferences, creating a feedback loop that narrows your musical world instead of expanding it. They assume your past dictates your present -- but your mood right now might be nothing like it was yesterday.
What if music didn't just match your taste, but matched your mind?
MindBeats flips the paradigm. Using a Brain-Computer Interface (BCI) headset, we read your brain's electrical activity in real-time, decode your emotional state through deep learning, and generate a playlist that truly reflects how you feel -- not just what you've listened to before.
Music doesn't determine your mood. Your mood should determine your music.
┌─────────────────┐ LSL Stream ┌──────────────────────┐
│ Muse 2 EEG │ ──────────────────▶ │ Signal Processing │
│ (4 channels) │ 256 Hz raw EEG │ │
│ TP9 AF7 AF8 TP10 │ ● Downsample → 128Hz│
└─────────────────┘ │ ● Bandpass 4-45 Hz │
│ ● Zero-mean norm │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ EmotionNet V2 │
│ (Deep CNN) │
│ │
│ Conv2D(32) → Pool │
│ Conv2D(64) → Pool │
│ Conv2D(64) → Pool │
│ Conv2D(64) → Pool │
│ Conv2D(64) │
│ Dense(64) → Dense(3)│
└──────────┬───────────┘
│
Valence, Arousal, Dominance
│
▼
┌──────────────────────┐
│ Mood Classifier │
│ │
│ VAD → Emotion Label │
│ (8 mood categories) │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ GPT-4o-mini │
│ │
│ Emotion → 10 songs │
│ (no repeats) │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Streamlit UI │
│ │
│ Live EEG plot │
│ Mood display │
│ Playlist render │
└──────────────────────┘
The model outputs three continuous dimensions -- Valence, Arousal, and Dominance -- which are mapped onto the psychological circumplex model of affect to determine mood:
The Valence-Arousal circumplex model used for emotion classification
| Valence | Arousal | Dominance | Mood |
|---|---|---|---|
| High | High | High | Mildly Positive & Confident |
| High | High | Low | Slightly Positive but Hesitant |
| High | Low | High | Calm & Neutral |
| High | Low | Low | Relaxed but Withdrawn |
| Low | High | High | Frustrated but Assertive |
| Low | High | Low | Stressed & Overwhelmed |
| Low | Low | High | Indifferent & Passive |
| Low | Low | Low | Sad & Low Energy |
- Connect -- Strap on the Muse 2 headset and start streaming EEG data via BlueMuse (LSL protocol).
- Record -- MindBeats captures ~10 seconds of 4-channel EEG data (TP9, AF7, AF8, TP10) across 5 iterations.
- Process -- Raw signals are downsampled from 256 Hz to 128 Hz, bandpass filtered (4-45 Hz), and zero-mean normalized.
- Predict -- Processed EEG chunks are fed into EmotionNet V2, a 5-layer Convolutional Neural Network that outputs Valence, Arousal, and Dominance scores (scaled 1-9).
- Classify -- The VAD scores map to one of 8 mood categories using the circumplex model.
- Recommend -- The detected mood is sent to GPT-4o-mini, which generates 10 personalized song recommendations with no repeats across sessions.
- Listen -- The playlist is rendered in a sleek Streamlit interface with Spotify and YouTube links.
| Layer | Technology | Purpose |
|---|---|---|
| Hardware | Muse 2 EEG Headset | 4-channel EEG signal acquisition |
| Streaming | BlueMuse + pylsl | Lab Streaming Layer protocol for real-time data |
| Signal Processing | SciPy, MNE-Python | Resampling, bandpass filtering, normalization |
| Deep Learning | TensorFlow / Keras | EmotionNet V2 CNN for emotion prediction |
| Recommendation | OpenAI GPT-4o-mini | Context-aware song recommendation |
| Frontend | Streamlit | Real-time dashboard with live EEG plots |
| Visualization | Matplotlib | EEG waveform rendering |
MindBeats/
├── app/
│ ├── main.py # Entry point -- Streamlit app with EEG pipeline
│ ├── emotionutils.py # EEG processing, model loading, mood classification
│ ├── gpt.py # OpenAI integration for song recommendations
│ ├── home.py # Landing page component
│ ├── player.py # YouTube playback utility
│ └── test_html.py # HTML rendering test
├── models/
│ └── EmotionNetV2.h5 # Pre-trained CNN weights
├── assets/
│ ├── EmotionSpace.png # Valence-Arousal circumplex diagram
│ ├── log.png # MindBeats logo
│ └── ex.html # HTML template
├── requirements.txt
├── .gitignore
└── README.md
- Python 3.10+
- Muse 2 EEG Headset
- BlueMuse (Windows) for LSL streaming
- An OpenAI API key
git clone https://github.com/pranayjoshi/mind_music.git
cd mind_music
pip install -r requirements.txtCreate a .env file in the project root:
KEY=your_openai_api_key_here
- Pair your Muse 2 headset via Bluetooth.
- Start BlueMuse and begin streaming.
- Launch the app:
streamlit run app/main.py| Name | |
|---|---|
| 1 | Pranay Joshi |
| 2 | Gaurav Shrivastava |
| 3 | Kavya Gupta |
| 4 | Priyanshu Sethi |
Built with brainwaves at UGAHacks X

