Fun with brainwaves, part 3: Here’s some code
So the code is finally somewhat presentable for public consumption. You can download it from here: Realtime Neurodata Display. If you have the Research Edition of the Emotiv SDK, this is what you’ll see:
EmoEngineClientLibrary displaying realtime brainwave data from the Emotiv headset.
The two most interesting features of this prototype are:
- Event-driven access to the Emotiv EmoEngine class;
- Multithreaded rendering of WPF controls.
I tried to make the EmoEngineClient as easy to use as possible: call the StartEmoEngine and StartDataPolling methods to be notified about changes in the neuroheadset device state and to receive new electrode data frames. You can use data binding to any of the convenient properties in the EmoEngineClient and EmotivState classes.
The NeuroDataControl shows how to consume the electrode data that EmoEngineClient publishes. It creates a TimeSeriesControl for each data channel, each of which renders on its own thread. The UI is simple, but it demonstrates that it’s possible to keep up with the fire hose of data that streams from the neuroheadset.
There’s a lot left to do: Fast Fourier Transforms (getting there), contact quality for each channel (almost there), optimizations…but it’s probably useful for anybody who wants to dive into the brainwave stream.