Introduction: EEG - NeuroSky MindWave Mobile 2 + SuperCollider
Lately, I've purchased a NeuroSky MindWave Mobile 2 headset and managed to get the data out of it - under my Linux Mint system. More details on the next steps.
I also wrote some cslang code for the amazing SuperCollider audio server.
Currently, the SC plays random notes of a pre-defined musical scale. There are more parameters change randomly - amplitude, legato and so on.
I took the meditation & attention values from the MindWave and sent it through OSC to the SuperCollider.
These two values control the SC this way:
- The attention (0 to 100) determines the size of the virtual keyboard - how many octaves to play at.
- The meditation (0 to 100) determines the starting point of the virtual keyboard.
Now, I've decided that the higher the attention value is, the size of the keyboard decreased and the higher the meditation value is, the starting point decreased.
So, in other words - high values of attention and meditation - low tones and only few of them. While listening to the tracks I've attached, you can see what I mean.
Step 1: Interfacing the MindWave
First thing I've done with the MindWave was to test it with some Android apps. There's a nice app I'm using:
https://play.google.com/store/apps/details?id=com....
very colourful and pleasant.
another one is:
https://play.google.com/store/apps/details?id=com....
The next thing was to check if I can see the raw data.
Connected to rfcomm0 and dumped the data:
$ tail -f /dev/rfcomm0 | hexdump -C
As there's no official SDK for the MindWave by NeuroSky, I've found NeuroPy (python library) which works just great.
$ pip install NeuroPy
The python code:
from NeuroPy import NeuroPy
neuroPy=NeuroPy("/dev/rfcomm0") neuroPy.start()
while True:
print "Meditation ", neuroPy.meditation
print "Attention ", neuroPy.attention
* The full code for SuperCollider integration is attached here:
Step 2: Musicbox in Sclang
It took few days for me to study the SuperCollider environment and language. The end results are amazing.
Just check out the code and listen to the music.
Have fun :)
btw, remove the txt extension from the osc-sc.scd.txt file
Attachments
Step 3: Music
The music is passed through a guitar effects software called: Rakarrack
Indian scale - Clean Swirl effect in Rakarrack
Nairuz scale - Angel's Chorus
Aeolian scale - Ambient Flange
Nikriz scale - Octaflange
Romanian Minor scale - Angel's Chorus
Marva scale - Angel's Chorus
Prometheus scale - Angel's Chorus
Hex Phrygian scale - Angel's Chorus
Minor Pentatonic scale - Angel's Chorus
* The original post can be found here, on my blog:
Comments