This is a BrainFlow implementation of my bci-workshop fork that sends your brain's relaxation and focus metrics to vrchat avatar paramaters via OSC.
Why BrainFlow?
The BrainFlow library provides a uniform API that is device agnostic, allowing this implementation of my workshop fork to work for all supported biosensors (including the muse headbands). No extra software needed!
Demos
- Rantis's Brain Controlled Ears
- Brain Controlled Ears: Five Months Later [VRChat]
- VRCHAT OSC MAGIC! (Last 30 seconds)
- Old version of Brain Controlled Ears
Instructions
- Download this project to a folder and remember its folder path
- Install Python 3.11.5
- Open the command prompt by typing searching cmd at the start menu
- Navigate to the project's path within the command prompt.
- example:
cd "C:\Users\<YOUR USERNAME HERE>\Documents\GitHub\BrainFlowsIntoVRChat"
- example:
- Execute this command to install needed depedencies:
pip install -r requirements.txt
- Look up your device's id: Board IDs Page
- Turn on your headband
- Run the script
main.py
with your device id. The command for running with a Muse 2 headband would be:python .\main.py --board-id 38
OSC Avatar Parameters
Avatar parameters being sent are floats that range from -1.0 to 1.0. Negative and Positive values correspond to low and high focus/relaxation. Update your avatar paramaters as needed to influnece animations and the like. Parameters are also seperated by left and right sides of the brain. Have fun!
osc_focus_left
osc_relax_left
osc_focus_right
osc_relax_right
osc_focus_avg
osc_relax_avg
For easier startup, I've added a hue shift parameter based on the focus and relax values. This parameter will range from 0.0 to 1.0.
HueShift
Added are optional paramaters that appear based on whether or not your headband supports it.
osc_battery_lvl
(int [0-100])osc_heart_bpm
(int[0-255])osc_oxygen_percent
(float[0.0-1.0])osc_respiration_bpm
(int[0-255])
I've also added the alpha, beta, theta, delta, and gamma band power ratios between left, right sides of the head as well as avg. You can access them via this path:
osc_band_power_(head_location)_(brainwave name)
(float [0-1]) (without the parenthesis)
For debug, a boolean paramater is sent to monitor the connection status of the headband as well as a time difference parameter to show the difference between last sample time and current time in seconds.
osc_is_connected
(boolean)osc_time_diff
(float)
Thanks to @Mitzi_DelverVRC and AartHark for help with PPG signal work
Thanks to @wordweaver1001 for intial user testing
-
I have broken bluetooth adapter built into my pc and I would like to use a dongle instead. How can I connect my headband to that dongle?
- Disconnect the bluetooth dongle you want to use
- Search up 'device manager' on the start menu
- Find an entry for a bluetooth radio, right click on it and disable it
- Plug the new bluetooth dongle back in
-
Muse Headband connects just fine but times out after a few seconds. Solution: Reset the headband
- Turn off the headband
- Press and hold the power button until it turns on. Keep pressing until the light changes.
- Reconnect.
-
I've set up everything and made a new avatar, but its still not reacting
- Reason: VRChat stores cached OSC parameters for your avatar that aren't updated when the avatar is updated with new parameters
- Solution: Go to C:\Users\(USERNAME)\AppData\LocalLow\VRChat\VRChat and delete all folders under it, then reload avatar
MIT.