> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elata.bio/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> Install and initialize the @elata-biosciences/eeg-web WASM package

## When To Use This Package

Use `@elata-biosciences/eeg-web` when your app needs:

* EEG analysis APIs in the browser
* shared EEG web contracts used by higher-level integrations
* browser-side access to Elata WASM models and signal-processing helpers

This package does not implement Bluetooth device connection. Add `@elata-biosciences/eeg-web-ble` if you also need live Muse-compatible browser transport.

> [!TIP]
>
> New to the SDK? Start by scaffolding a demo app with `create-elata-demo` before wiring packages manually. See the [First App tutorial](https://docs.elata.bio/sdk/tutorials/first-app.md).

***

## Installation

```bash pnpm theme={null}
pnpm add @elata-biosciences/eeg-web
```

```bash npm theme={null}
npm install @elata-biosciences/eeg-web
```

Requirements: Node.js 20+ for server-side usage and local repo tooling; modern browser with WebAssembly support for in-browser usage.

***

## WASM Initialization

Before using any signal processing or model APIs, initialize the WASM module:

```typescript theme={null}
import { initEegWasm } from "@elata-biosciences/eeg-web";

await initEegWasm();
```

`initEegWasm` is idempotent. Calling it multiple times returns the same promise. For synchronous initialization (e.g., in a Web Worker):

```typescript theme={null}
import { initEegWasmSync } from "@elata-biosciences/eeg-web";

initEegWasmSync(wasmModule);
```

***

## Basic Usage

Compute band powers from EEG data:

```typescript theme={null}
import { initEegWasm, band_powers } from "@elata-biosciences/eeg-web";

await initEegWasm();

const sampleRate = 256;
const eegSamples = new Float32Array(/* ... one channel of EEG samples ... */);

const powers = band_powers(eegSamples, sampleRate);
console.log("Alpha:", powers.alpha);
console.log("Beta:", powers.beta);
console.log("Theta:", powers.theta);
console.log("Delta:", powers.delta);
console.log("Gamma:", powers.gamma);
```

***

## Package Structure

`@elata-biosciences/eeg-web` is a thin TypeScript wrapper around WASM bindings generated by `wasm-bindgen`:

* `initEegWasm` / `initEegWasmSync`: WASM initialization helpers
* Headband frame types: normalized data schema for EEG transports
* All WASM APIs: re-exported from the generated bindings

### Key Exports

* `initEegWasm`
* `initEegWasmSync`
* `band_powers`
* `WasmAlphaBumpDetector`
* `WasmAlphaPeakModel`
* `WasmCalmnessModel`
* `AthenaWasmDecoder`
* `createRppgPipeline`
* Frame helpers: `getEegChannelSamples`, `getEegInterleavedSamples`, `getEegSignalBlock`
* Preprocessing: `createEegPreprocessor`, `processHeadbandFrame`
* Errors: `ElataError`, `isElataError`, `asElataError`

> [!NOTE]
>
> Generated `wasm-bindgen` exports are re-exported for compatibility and SDK debugging. Avoid instantiating generated wrappers directly unless you are intentionally debugging the SDK itself.

***

## Next

> [card] [Choose A Package](https://docs.elata.bio/sdk/guides/choose-the-right-package.md)
>
> Not sure if this is the right package? See the decision guide.

> [card] [Add EEG to an Existing App](https://docs.elata.bio/sdk/tutorials/eeg-existing-app.md)
>
> Step-by-step integration tutorial

> [card] [Signal Processing](https://docs.elata.bio/sdk/eeg-web/signal-processing.md)
>
> Band powers, FFT, spectrum analysis

> [card] [Models](https://docs.elata.bio/sdk/eeg-web/models.md)
>
> Alpha bump detection, calmness scoring

> [card] [Headband Transport](https://docs.elata.bio/sdk/eeg-web/headband-transport.md)
>
> Frame schema and transport interface


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.