Zero-backend JavaScript browser IDE for EEG.
Hardware stream uses the JavaScript SDK.
packages/core— headless engine, file buffers, Comlink worker lifecyclepackages/react— CodeMirror 6 wrappers and<SynapseIDE />apps/demo— Vite playground (editor left, terminal right)
Student JS runs in a Web Worker. The sandbox injects:
tf(@tensorflow/tfjs, CPU backend)EEG/Context.EEG— latest streamed framebio— windowed history, recording, features, and small modelsconsole,check(condition, message)plot(title, values)/plot({ title, kind, labels, values|series })
Plots render above stdout in Output.
The host keeps a rolling frame history (mock or live) and seeds the worker on Run. EEG is one frame. bio.window(seconds) is the time window behind it.
| Call | Role |
|---|---|
bio.window(seconds) |
frames in the last N seconds |
bio.signal(name|channel, seconds) |
one series over that window |
bio.features(frames) |
mean bands + focus / relaxation |
bio.record(label, ms) |
wait, then append a labelled epoch |
bio.dataset() |
{ X, y, labels } for the session |
bio.logreg(X, y) |
L2 logistic regression |
bio.crossValScore(X, y, k) |
stratified k-fold, balanced accuracy |
bio.cohensD(a, b) |
within-session effect size |
Also: isFocused, isRelaxed, bandPower, bands, mean, std, rms, zscore, fft, bandpower, kfold, trainTestSplit, accuracy, balancedAccuracy, confusion, sleep, clearDataset, epochs, help.
The session dataset lives in the worker until reload. History is frame-rate (about 12-30 Hz), not the full 250 Hz raw stream.
The toolbar Recipes menu loads commented examples. API opens the sandbox list and the JavaScript SDK. Type EEG. or bio. in the editor for completions.
- SDK helpers
- Hello EEG
- Band tensor
- Tiny predict
- Train a blink
- Focus gate
- Assert a model
- Window features
- Calibrate a classifier
Click Mock (or Connect), pick a recipe, then Run (Ctrl+Enter / ⌘↵). Window / calibrate recipes need the stream running first.
Optional hidden checks can be passed to IdeEngine (checks option or setChecks()). They are appended after the buffer on Run and never shown in the editor.
npm install
npm run devThen open the printed local URL and click Run. JavaScript executes in a Web Worker.