Again with the brainwaves


I’m still playing around with the EPOC neuroheadset by Emotiv, as described in previous posts, such as Realtime Brainwave Data with WPF and Fun with brainwaves, part 3: Here’s some code. This time, I’m converting brainwaves into soundwaves in realtime (well, near-realtime).

I’ve built a simple signal processing pipeline, and I feed it signals from the EPOC’s neurodata stream. Once the brainwaves are transformed into frequency space, I do some filtering and then emit an audio signal that’s synthesized by using an inverse FFT. The raw sine waves are a bit brutal on the ears, so I also drive the MIDI device with pitches that corresponding to various brainwave frequencies. This produces some interesting sci-fi sound effects that resemble the score to the last act of 2001: A Space Odyssey.

Here’s a quick video that demonstrates the signal pipeline in action.

Comments (4)

  1. macias says:

    Nice!!! Just out of curiosy, how long did it take you to write this app? The instrumental overlays seem quite impressive I must say.

  2. jgalasyn says:

    Thanks, macias! It probably took a week altogether. The hardest part was figuring out how to create an in-memory WAV file for the the raw synthesized signal. The MIDI part turned out to be the easiest!

  3. tgraupmann says:

    It sounds like my atari in the 1980s. I heard similar sounds with the Epoc headset. http://www.youtube.com/watch

  4. tgraupmann says:

    I have a similar idea. Lets say you have a nice set of sounds that don't hurt the ears.

    //88 piano key frequencies – high to low

    double[] frequencies = { 4186.01, 3951.07, 3729.31, 3520, 3322.44, 3135.96, 2959.96, 2793.83, 2637.02, 2489.02, 2349.32, 2217.46, 2093, 1975.53, 1864.66, 1760, 1661.22, 1567.98, 1479.98, 1396.91, 1318.51, 1244.51, 1174.66, 1108.73, 1046.5, 987.77, 932.33, 880, 830.61, 783.99, 739.99, 698.46, 659.26, 622.25, 587.33, 554.37, 523.25, 493.88, 466.16, 440, 415.31, 392, 369.99, 349.23, 329.63, 311.13, 293.67, 277.18, 261.63, 246.94, 233.08, 220, 207.65, 196, 185, 174.61, 164.81, 155.56, 146.83, 138.59, 130.81, 123.47, 116.54, 110, 103.83, 98, 92.5, 87.31, 82.41, 77.78, 73.42, 69.3, 65.41, 61.74, 58.27, 55, 51.91, 49, 46.25, 43.65, 41.2, 38.89, 36.71, 34.65, 32.7, 30.87, 29.14, 27.5 };

    Now rather than playing the FFT frequencies, build a hash of the sampled frequencies while playing a piano note. Now think of a note and select the piano frequency that most closely matches. Try single notes and then simultaneous notes.