Extracting frequency bands (alpha, beta, gamma etc.) from raw EEG data

Tags: #<Tag:0x00007fcb74d7ddf8>

I recently bought a NeuroSky MindWave Mobile headset. So far, I have written a simple Visual C# program that reads raw EEG data from the headset (via Bluetooth).

I would like to process this raw data and display the EEG band frequencies (delta, theta, alpha, beta & gamma) to the user. From what I have understood, this will most likely require a Fast Fourier Transform.

I have also read that ocular artefacts (e.g. eye blinks) and other noise needs to be filtered prior to extracting these frequencies.

Which filters should I use and what are the best open-source .NET libraries with implementations of these filters? Code examples would be lovely as well!

Many thanks in advance for any help whatsoever! I really appreciate it.



You can use some of FFT libraries for C#
Roughly, you can do the following.
Divide your signal into epoch (for example 1-4 seconds long).
For each of the epochs, calculate FFT.
Average for all epochs.
If your epoch is for example 1 second long, and sampling rate is Fs = 250 HZ, then you shall obtain 125 samples of FFT. This is related to the frequency ranges from 0 - 125Hz (Fs/2). Then you need to sum samples in the rage of interest. For example, teh sample related to 12 Hz =
If you need any help, you can send me the file so that I can try and give you the code.
There are better ways to do this, with Hamming or other averaging windows, but this is the most basic way.



If you just want SOME of the bands, for example if you are doing a neurofeedback program that rewards / inhibits certain bands – the alternative is to use band filters instead of FFT. This is a common approach used in VPL’s such as BrainBay, BioEra, Bioexplorer, OpenViBE, neuromore, etc.

An excellent C language IIR filter design library is Jim Peters FIDLIB. It’s actually the engine used by BioEra and BrainBay. A great feature of this library is that the filter type (bandpass, lowpass, highpass, notch; Butterworth, Bessel, etc.) and band edges can all be specified at runtime. This is how the VPL’s allow dynamic changing of these parameters.