Details

ai / research

Brain Signal Processing Game

Brain Signal Processing Game is a neurofeedback research software project connecting OpenBCI/LSL EEG acquisition, Python processing, Welch PSD beta-feature output and a Pygame feedback loop.

Live 3D architecture

Use the navigator to move between diagrams and related work, then scroll for more details.

OpenBCI EEG becomes a beta-rhythm control stream before it ever reaches the game.

Problem

The research software needed a closed loop from OpenBCI EEG acquisition to real-time signal processing and readable game feedback for an adult ADHD neurofeedback protocol. The page frames this as research software rather than a clinical efficacy claim.

Contribution

I volunteered with BNEURD as a Data Analyst and Software Engineer and designed/implemented the real-time EEG processing server: stream handling, buffering, Welch band-feature extraction and game-facing beta marker output. The game/UI was produced by the team. The research protocol specifies filtering, while the processing implementation leaves filter application commented out.

Signal And Game Loop

Research protocol values: OpenBCI GUI acquisition, 8 EEG electrodes in 10/20 placement, 3-second processing batches, 300 ms refresh, 60 Hz notch and 4–100 Hz bandpass in the paper, Welch frequency-domain features and beta rhythm communication to the game. The processing server uses 256 Hz/8-channel setup, LSL EEG input, Welch PSD bands, 0.3 s refresh and beta marker output; its executable path uses a 4-second buffer and initial filter arguments notch=60, lowcut=5, highcut=35 while the filter application block in processSample is commented out; these timing and filter differences separate the paper protocol from the executable path.

Technical decisions

LSL separated OpenBCI acquisition, signal processing, and gameplay so each layer could be developed and inspected independently
Python, pylsl, NumPy, SciPy, and Welch PSD were used for fast iteration on EEG windows and band extraction
The paper protocol specifies a 60 Hz notch filter plus 4–100 Hz bandpass before frequency-domain analysis; the processing implementation keeps the filter application commented while still passing initial 60/5/35 filter arguments.
Beta rhythm was used as the game-facing attention marker, matching the research protocol for adult ADHD neurofeedback
Pygame was chosen for local full-screen experiment control, sprite rendering, audio cues, and real-time marker-driven feedback
The game used a blue calm visual field, yellow direction/focus cue, 2 second baseline, short configurable sessions, and smile feedback as reinforcement

Research Context

I contributed to a BNEURD collaboration on a June 2024 CONCCEPAR neurofeedback paper, “Desenvolvimento de software para neurofeedback - modulação cerebral para manejo de déficits atencionais em adultos com TDAH.”

Tradeoffs

Research prototype clarity over a reusable clinical platform
Local lab execution over web deployment
Single beta-marker control over a broader multimodal feature API

Outcome

A concrete brain-computer interaction artifact: EEG acquisition, signal processing, asynchronous data transport, and an interactive neurofeedback game connected into one reproducible research software loop.

Signal-processing layer

The processing server is the bridge between raw EEG and game behavior. It waits for stable stream data, buffers samples into experiment-sized windows, computes Welch band features, and emits a simple marker that the game can consume without knowing anything about EEG acquisition. Paper-vs-code filter differences are documented separately.

OpenBCI GUI acquisition
LSL inlet and outlet
Paper: 3-second windows; executable code: 4-second buffer and 0.3-second refresh
Paper: 60 Hz notch plus 4–100 Hz bandpass; code: initial 60/5/35 filter args with application commented
Welch PSD band extraction
Beta marker output

Game layer

The Pygame interface was designed as a feedback instrument rather than a normal game. It keeps the screen calm, uses a clear focus target, maps beta activity to aircraft movement, and separates baseline, active trial, and feedback states.

Blue low-distraction background
Yellow focus direction cue
2 second baseline phase
6-10 second training sessions
Audio start cue
Smile feedback reinforcement

Stack and domains

  • Python
  • OpenBCI
  • Lab Streaming Layer
  • pylsl
  • NumPy
  • SciPy
  • Welch PSD
  • Pygame
  • EEG
  • neurofeedback
  • BNEURD