Real-time content recommendation driven by brainwaves β reads EEG emotion states from an Emotiv headset and surfaces personalized video suggestions on the fly.
Built on the Emotiv Cortex SDK, the system runs as a microservice pair: one service processes raw EEG signals into emotion states, the other maps those states to a continuously-updated recommendation feed.
- EEG β Emotion β Emotiv headset streams 7 affective metrics (engagement, excitement, stress, relaxation, focus, interest, arousal). A weighted model maps them to 9 emotion classes: Happy Β· Sad Β· Angry Β· Tired Β· Relaxed Β· Surprised Β· Disgusted Β· Pleased Β· Neutral
- Emotion β Content β Each emotion maps to a content category with intensity thresholds (>40% required to trigger a switch). A user-learning layer tracks likes, skips, and shares to personalise over time
- Optional: EEG β Music β Parallel audio service uses Google Lyria to generate ambient music matching the current emotion state
Emotiv Headset
β Cortex SDK (WebSocket)
βΌ
brain_processor.py ββ(HTTP)βββΆ recommendation_service.py βββΆ Client / Frontend
β β
βββ(HTTP)βββΆ audio_service.py ββ user_learning.py (feedback loop)
(Google Lyria)
- Hardware: Emotiv EPOC X / EPOC Flex (Cortex SDK v3)
- EEG processing: Python Β· numpy Β· websocket-client
- Services: Flask (port 8081) Β· FastAPI/Uvicorn (port 8080)
- Music generation: Google Lyria real-time API
- Audio playback: sounddevice (48 kHz stereo)
# 1. Install dependencies
pip install -r EEG/requirements.txt
pip install -r recommandation/requirements.txt
# 2. Add your keys to .env
EMOTIV_CLIENT_ID=...
EMOTIV_CLIENT_SECRET=...
GOOGLE_API_KEY=... # optional β for music generation
# 3. Run
python start_recommendation_only.py # recommendation only
python start_integrated_system.py # + music generationRequires the Emotiv Cortex App running locally and a connected Emotiv headset.