Skip to content

Conn-Ho/neuro-rec

Repository files navigation

🧠 neuro-rec

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.

How it works

  1. 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
  2. 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
  3. Optional: EEG β†’ Music β€” Parallel audio service uses Google Lyria to generate ambient music matching the current emotion state

Architecture

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)

Stack

  • 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)

Quick start

# 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 generation

Requires the Emotiv Cortex App running locally and a connected Emotiv headset.

About

🧠 EEG-driven content recommendation β€” Emotiv headset β†’ emotion state β†’ personalized video feed, with optional AI music

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages