PROJECT ID: OSC-2025 // NEUROTECHNOLOGY
Real-Time Emotion Detection & Music Therapy
Built in 24 hours at the Heroes of The Brain 2025 Hackathon: a complete brain-computer interface platform that reads real-time EEG brainwave data, classifies emotional states using a weighted ensemble of deep learning and gradient boosting models, and automatically curates Spotify playlists to guide users toward calm. Designed for pre-operative anxiety reduction and therapeutic applications.
View RepositorySystem Overview
The Problem
Pre-operative anxiety affects up to 80% of surgical patients, leading to increased anesthesia requirements, longer recovery times, and worse outcomes. Traditional interventions like sedatives have side effects. We built a non-invasive, personalized solution using neurofeedback and music therapy.
Our Solution
Oscillate continuously monitors brain activity, detects emotional states in real-time, and responds with curated music designed to guide the user toward a neutral, calm state. The system creates a closed feedback loop: detect → intervene → measure → adapt.
Signal Processing Pipeline
EEG Acquisition
Raw brainwave data is captured from 4 electrode channels (AF3, AF4, O1, O2) at 125Hz via the Lab Streaming Layer (LSL) protocol. The frontal channels capture emotional valence while occipital channels provide arousal indicators.
Feature Engineering
Relative band powers are computed for each channel across all 5 frequency bands, yielding 20 base features. These undergo log transformation and polynomial expansion before standardization, creating a rich feature space for the ensemble model.
Technical Architecture
WideResNet Classifier
1024-dimensional hidden layers with 3 residual blocks and dropout regularization (0.3-0.4). Contributes 60% weight to the ensemble prediction.
Gradient Boosting
Scikit-learn implementation with optimized hyperparameters. Provides robustness and contributes 40% weight to the final ensemble output.
FastAPI + WebSocket
High-performance async Python server handling LSL stream ingestion, real-time inference, and WebSocket broadcasting at 10Hz.
React + Three.js
Interactive 3D brain visualization using React Three Fiber with real-time emotion-based color mapping and Spotify Web Playback SDK integration.
Contributors
- Iwo Smura
- Iwo Wojtakajtis
- Karina Leśkiewicz
- Wiktoria Malinowska
- Paweł Litwin
Gallery