Three virtual scalp electrodes — C3 (left motor cortex), Cz (vertex) and C4 (right motor cortex) — each generate a synthetic EEG trace: a superposed mu rhythm (~10 Hz, bursty amplitude) and beta rhythm (~20 Hz), plus pink-ish noise, sampled at 128 Hz. This is real signal synthesis, not a lookup — every sample is computed from oscillators and noise each frame.
When you trigger imagined right-hand movement, the amplitude of C3 (the hemisphere that controls the right hand) is smoothly suppressed — this is event-related desynchronization (ERD), the well-documented drop in mu/beta power over the contralateral motor cortex during real or imagined movement. Imagined left-hand movement suppresses C4 instead. Cz shows a smaller, bilateral dip, matching the weaker central ERD seen in real recordings.
Band power is not faked either: a sliding 256-sample (2 s) window per channel is fed through the Goertzel algorithm — the standard efficient single-frequency DFT bin — evaluated at 10 Hz and 20 Hz, recomputed every sample. The decoder then forms a laterality index (P_C3 − P_C4) / (P_C3 + P_C4) from the live mu-band power and classifies left vs. right from its sign and magnitude — exactly the feature real motor-imagery BCIs (e.g. the classic C3/C4 mu-ERD paradigm) use.
P(f) = Goertzel(window, f, fs) // real DFT bin power
LI = (P_C3 − P_C4) / (P_C3 + P_C4)
LI > +thr → "Left hand" (C4 suppressed)
LI < −thr → "Right hand" (C3 suppressed)
else → "Rest"
- Background EEG noise — raises the noise floor the decoder has to see through; too high and the laterality index gets noisy and misclassifies.
- ERD suppression depth — how strongly imagery drops the affected channel's mu/beta power; a shallow drop is realistic but harder to decode reliably, exactly as with real, noisy BCI users.
Real-world relevance: this C3/C4 mu/beta ERD paradigm underlies real EEG motor-imagery BCIs used for assistive control (wheelchairs, prosthetics, spellers) and post-stroke neurorehabilitation.