PROJECT 02

Dual-Paradigm BCI Speller — P300 + SSVEP

Two paradigms, one interface

A systems exercise: take two published BCI decoding methods (P300 and SSVEP) from research paper to a working pipeline with a hardware abstraction layer, a real-time calibration workflow, and an honest account of exactly where "working on public research data" stops and "working for a real person on real hardware" would need to start.

  • P300
  • SSVEP
  • EEG
  • xDAWN
  • CCA
  • FBCCA
  • LSL
  • GPT-2
// system_architecture5 STAGES
BNCI2014009 / Nakanishi2015
Hardware Abstraction Layer
xDAWN+LDA (P300) / CCA+FBCCA (SSVEP)
Calibration (Warm-Start)
OS Keypress Output

Question

How do P300 and SSVEP decoding pipelines compare in a speller setting, and what are the practical calibration and signal-processing tradeoffs between them?

Why It Matters

BCI spellers are one of the most studied assistive BCI applications. Comparing two paradigms in one codebase makes the engineering and decoding tradeoffs explicit rather than theoretical — including which paradigm needs calibration data and which is zero-shot by design.

System

A hardware abstraction layer with LSL auto-discovery, per-device channel mapping (with declared fallback for headsets missing electrodes), polyphase resampling, and online artifact rejection (amplitude / peak-to-peak / sliding-window variance). A P300 speller using xDAWN spatial filtering + shrinkage-LDA. An SSVEP engine with standard CCA, filter-bank CCA, and a supervised CNN baseline. An offline-replay demo wiring classifier output to pyautogui system keypress injection with real-time ITR (Wolpaw formula). A local GPT-2 predictive-text layer integrated into a pygame speller UI. A Streamlit app with a Research Demo and a Your Setup calibration flow.

Data

P300: BNCI2014009 (Aricò et al., 2014) via MOABB. SSVEP: Nakanishi2015 (Nakanishi et al., 2015) via MOABB. Both accessed through the MOABB benchmarking framework (Jayaram & Barachant, 2018).

Method

Preprocessing

Hardware abstraction layer handles LSL auto-discovery, per-device channel mapping with fallback substitution, polyphase resampling to target sample rate, and online artifact rejection (amplitude / peak-to-peak / sliding-window variance).

Feature Extraction

P300: xDAWN spatial filtering to enhance evoked potentials. SSVEP: canonical correlation analysis (CCA) and filter-bank CCA (FBCCA) for frequency detection — zero-shot by design, no training data needed.

Model

P300: xDAWN + shrinkage-LDA classifier. SSVEP: CCA, FBCCA, and a supervised CNN baseline, compared head-to-head on the same dataset.

Training

P300: offline cross-validated training on BNCI2014009 (5-fold CV). SSVEP: CCA/FBCCA are zero-shot — no training. CNN baseline trained with up to 10 examples/class. Warm-start blending combines a public-data prior model with the user's personal model.

Evaluation

P300: 5-fold CV accuracy, balanced accuracy, ROC-AUC on BNCI2014009 subject 1. SSVEP: zero-shot accuracy on Nakanishi2015 subject 1 (12-class). Offline replay: accuracy and ITR (Wolpaw formula) on pre-recorded epochs. Calibration marker-EEG sync verified via mock stream.

Experiment

Both paradigms were benchmarked head-to-head on the same public datasets. For P300, xDAWN+LDA was cross-validated with 5-fold CV. For SSVEP, three methods (CCA, FBCCA, supervised CNN) were compared on the same 12-class problem. The offline replay demo classifies pre-recorded epochs and types the result via pyautogui — explicitly not a live-headset closed loop. Calibration pipeline correctness was verified with a mock LSL stream: 119 epochs extracted, target/non-target counts matched the flash schedule exactly.

Results

SystemResult
P300 (xDAWN+LDA), BNCI2014009 subj. 188.4% ± 1.8% acc (0.783 balanced acc, baseline 83.3%), 0.918 ± 0.013 ROC-AUC
SSVEP FBCCA, Nakanishi2015 subj. 1 (12-class)77.8% zero-shot (vs. CCA 70.4%; CNN near chance at all calibration budgets)
Offline replay → OS keypress (FBCCA, pre-recorded)86.67% accuracy, 38.36 bits/min ITR, 15 selections
Calibration marker-EEG sync (mock stream)119 epochs extracted, counts matched flash schedule exactly

Full methodology and per-fold breakdowns in docs/BENCHMARKS.md.

P300 achieved 88.4% accuracy but with a majority-class baseline of 83.3% — the balanced accuracy of 0.783 is the more honest number. SSVEP FBCCA at 77.8% zero-shot outperformed standard CCA (70.4%); the supervised CNN baseline stayed near chance at every calibration budget tested (up to 10 examples/class), suggesting that on this dataset, CCA/FBCCA's signal-modeling approach is more sample-efficient than a small CNN. The offline replay demo achieved 86.67% accuracy and 38.36 bits/min ITR — but this is an online decoder running on offline data, not a live EEG closed loop.

What Changed

The warm-start scheme was designed to blend a public-data prior model with the user's personal model while they still have little data. However, the public P300 prior model only overlaps the personal calibration montage on 3 of 5 channels (Oz, Cz, Pz — BNCI2014009 doesn't have O1/O2), capping its usefulness. SSVEP "calibration" isn't training at all — CCA/FBCCA are zero-shot by design, so that wizard is a detectability check, not a model-fitting step.

Limitations

  • No real headset has touched this code — everything is verified against public datasets or synthetic noise.
  • Warm-start channel overlap is thin (3 of 5 channels shared between prior and personal montage).
  • SSVEP calibration validates, it doesn't train — CCA/FBCCA don't use training data.
  • Single-subject numbers throughout — none of this has been checked for how much it varies across subjects.
  • Not reviewed for clinical or assistive use — no consent process, no usability testing, no safety review.

Next Experiment

Validate character-level decode on real signal (the row/column vote aggregation is built but only exercised on synthetic noise). Then build a genuine real-time closed loop with a live LSL headset feeding a causal, sample-by-sample decoder.