- meditation or breath-training apps that adapt guidance to focus or calmness
- neurofeedback experiences that reward attention or steadiness
- simulated athletic-performance or training apps that react to mental state
- games or creative tools that change difficulty, pacing, or effects based on live EEG features
Start With The Right Path
If you want a known-good reference app first, scaffold the EEG demo:Install
What eeg-web Gives You
@elata-biosciences/eeg-web provides:
- browser-side EEG WASM initialization
- signal-processing and model exports such as
band_powers - shared types and contracts used by higher-level browser integrations
@elata-biosciences/eeg-web-ble if you also need browser BLE transport.
How Apps Usually Use EEG
- Connect to a compatible headset or load sample buffers.
- Initialize the WASM runtime.
- Run feature extraction or analysis on incoming samples.
- Map those results into app state, scoring, content adaptation, or user feedback.
Minimal Integration
Typical Flow
- Initialize the packaged WASM runtime with
initEegWasm(). - Pass browser-side EEG sample buffers into the exported analysis functions.
- Add
eeg-web-blelater if you need live headset transport.
Vite Config
Two approaches work. Use whichever fits your setup: Option A — plugins (recommended for new projects)initEegWasm accepts a URL and fetches the WASM
manually, bypassing Vite’s ESM module handling entirely.
Common Gotchas
band_powers()takes a single-channelFloat32Array— notnumber[]. Convert withnew Float32Array(samples[channelIdx])before passing. Passing a plain array will cause a WASM runtime error. For a Muse headband (4 channels: TP9, AF7, AF8, TP10), use a frontal channel (AF7 = index 1, or AF8 = index 2) for cognitive state features, or average across channels.WasmCalmnessModel.process()expects interleaved samples:[s0_ch0, s0_ch1, s1_ch0, s1_ch1, ...]. Theframe.eeg.sampleslayout is per-channel — convert before passing.WasmCalmnessModelneedschannelCountat construction, butchannelCountonly arrives on the first frame. Construct the model inside your first-frame handler.- If
initEegWasm()fails, your app may not be serving the packagedwasm/assets correctly. See Vite config above. - If you need a live headset connection,
eeg-webalone is not enough.
Next Steps
- Browser BLE setup: Web Bluetooth With Supported Devices
- Package reference: eeg-web
- General troubleshooting: Troubleshooting