@elata-biosciences/ppg-web
v0.1.3
Published
TypeScript helpers for Muse PPG heart-rate and HRV estimation on the web
Downloads
179
Readme
@elata-biosciences/ppg-web
Browser-side Muse PPG heart-rate and HRV estimation built on the normalized
HeadbandFrameV1 stream used elsewhere in this repo.
What it does
- Consumes Muse
ppgRawand Athenaopticsframes. - Selects the best channel automatically, or lets you pin a source/channel.
- Estimates heart rate plus basic HRV metrics:
bpmrmssdMssdnnMsmeanNnMs
- Exposes a simple session wrapper on top of
HeadbandTransport. - Ships a simple in-repo demo at
./run.sh demo ppg.
Run the in-repo demo
If you have bash available in this repo:
./run.sh demo ppgIf you are on Windows PowerShell without bash, run the package directly:
corepack pnpm --dir packages/ppg-web run start-demoThen open http://127.0.0.1:8081/index.html.
For Muse S Athena devices, build EEG WASM artifacts first so the demo can load
AthenaWasmDecoder:
./run.sh build eeg
./run.sh demo ppgInstall
pnpm add @elata-biosciences/ppg-web @elata-biosciences/eeg-web @elata-biosciences/eeg-web-ble @elata-biosciences/rppg-webMinimal Muse usage
import { createMusePpgSession } from "@elata-biosciences/ppg-web";
const session = await createMusePpgSession({
windowSec: 16,
onDiagnostics: (diagnostics) => {
console.log(diagnostics.metrics.bpm, diagnostics.metrics.rmssdMs);
},
});
const metrics = session.getMetrics();
console.log(metrics.channel, metrics.source, metrics.bpm, metrics.rmssdMs);Generic transport usage
import { createPpgSession } from "@elata-biosciences/ppg-web";
const session = await createPpgSession({
transport,
autoStart: true,
source: "auto",
channel: "auto",
});Notes
- For classic Muse
ppgRaw, the transport currently carries local frame timing, so HRV should be treated as a developer preview until device timestamps are propagated end-to-end. - Athena
opticsalready preserves decoder timestamps and is the preferred path when available.
