@elata-biosciences/eeg-web
v0.1.2
Published
Web wrapper for the Elata EEG WASM bindings
Downloads
145
Readme
@elata-biosciences/eeg-web
Web wrapper for the Elata EEG WASM bindings. This package provides a simple init function and re-exports the generated WASM APIs.
Package intent
@elata-biosciences/eeg-web is intentionally a thin wrapper:
dist/index.js/dist/index.d.tsare small on purpose- they provide init helpers and re-export the generated WASM module
- the full API surface is generated by
wasm-bindgen
Install
Using pnpm (recommended):
pnpm add @elata-biosciences/eeg-webUsing npm:
npm install @elata-biosciences/eeg-webRequirements
- Node.js >= 18 for server-side usage.
- Modern browser with WebAssembly support for in-browser usage.
Device support
@elata-biosciences/eeg-web itself does not implement Bluetooth device connection logic.
It exposes WASM APIs that can be used with data from supported integrations
(for example, eeg-demo).
Current supported EEG headband integrations in this repo:
- Muse 2 / Muse S (classic BLE, 4 EEG channels: TP9, AF7, AF8, TP10)
- Muse S Athena (protocol v2, 8 EEG channels)
- Synthetic Muse-compatible BLE bridge (
Muse-Synthetic) for testing
Usage
import { initEegWasm, band_powers } from "@elata-biosciences/eeg-web";
await initEegWasm();
const powers = band_powers(eegData, 256);
console.log(powers.alpha);Key exports
initEegWasm/initEegWasmSync– helpers to initialize the underlying WASM module.band_powers,WasmAlphaBumpDetector,WasmAlphaPeakModel,WasmCalmnessModel,AthenaWasmDecoder– core signal and model APIs re-exported from the generated WASM bindings.
Build and sync WASM
From the repo root:
./run.sh build eegThis builds eeg-wasm, runs wasm-bindgen, syncs generated WASM files into
packages/eeg-web/wasm, and builds the TypeScript package.
Release Notes
For package publishing, release order, dist-tags (next/latest), and recovery
from bad releases, see docs/releasing.md.
TypeScript layout
src/*.ts: source code edited in this repodist/*.js: emitted runtime files used by consumersdist/*.d.ts: emitted type declarations used by TypeScript consumerswasm/*: generated wasm-bindgen artifacts re-exported by this package
When consuming @elata-biosciences/eeg-web, TypeScript resolves types from dist/index.d.ts
and runtime code from dist/index.js.
Where the API is defined
The full exported API (for example band_powers, WasmAlphaBumpDetector,
WasmAlphaPeakModel, WasmCalmnessModel, AthenaWasmDecoder) comes from:
packages/eeg-web/wasm/eeg_wasm.js(runtime)packages/eeg-web/wasm/eeg_wasm.d.ts(types)
src/index.ts re-exports everything from that module so consumers can import
from @elata-biosciences/eeg-web directly.
