The AverageBandPower example does all of the above work for you. The API outputs Theta, Alpha, Low Beta, High Beta and Gamma powers twice per second, evaluated from the last 2 seconds of data, for each sensor. The raw data is high-pass filtered, windowed, FFT transformed, converted to power and averaged over each band.
↧