Skip to content

Conn-Ho/neuro-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🎡 neuro-sync

Two brainwaves, one soundtrack β€” links two Emotiv EEG headsets over the network and fuses their emotional states into a single real-time AI-generated music stream.

Each participant's headset feeds into a local brain processor. The two emotion streams are merged on the host and sent to Google Lyria, which generates music that reflects the blended emotional state of both people in real time.

How it works

Person A β€” Emotiv headset ──▢ client_brain_processor.py ──(HTTP)──▢ ┐
                                                                       β”œβ”€β–Ά social_audio_service.py ──▢ Google Lyria ──▢ 🎡
Person B β€” Emotiv headset ──▢ host brain_processor.py   ──(HTTP)──▢ β”˜
  1. Each device runs a brain processor that converts raw EEG β†’ emotion state
  2. social_audio_service.py collects both states and runs an emotion fusion algorithm
  3. The blended state is converted to a detailed music prompt (BPM, key, instruments, dynamics)
  4. Google Lyria streams the generated audio at 48 kHz stereo, < 500 ms latency

Emotion β†’ Music mapping (sample)

Emotion BPM Key Instruments
Happy 120–140 Major Piano arpeggios, light percussion
Sad 60–80 Minor Strings, sparse piano
Angry 140–160 Diminished Distorted guitar, aggressive drums
Relaxed 70–90 Major pentatonic Ambient pads, soft guitar

16 emotion classes supported in total.

Stack

  • Hardware: 2 Γ— Emotiv EPOC X (Cortex SDK v3)
  • EEG processing: Python Β· numpy Β· asyncio
  • Services: FastAPI / Uvicorn
  • Music: Google Lyria real-time (lyria-realtime-exp)
  • Audio: sounddevice Β· pyaudio (48 kHz stereo)

Quick start

pip install -r EEG/requirements.txt

# Host machine (also runs the audio service)
python EEG/host_main.py

# Client machine (second headset)
python EEG/client_main.py --host <HOST_IP>

Requires two Emotiv headsets, Cortex App on each machine, and a Google API key with Lyria access.

About

🎡 Two EEG headsets, one AI-generated soundtrack β€” fuses brainwave emotion streams into real-time music via Google Lyria

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages