Skip to main content

Crate muse_rs

Crate muse_rs 

Source
Expand description

§muse-rs

Async Rust library and terminal UI for streaming EEG data from Interaxon Muse headsets over Bluetooth Low Energy.

§Supported hardware

ModelFirmwareEEG chPPGNotes
Muse 1 (2014)Classic4baseline feature set
Muse 2Classic4 + AUXPPG requires enable_ppg: true
Muse SClassic4 + AUXsame protocol as Muse 2
Muse SAthena8auto-detected; PPG always included with preset p1045

Athena PPG data is decoded from 20-bit LE packed samples (tag lower nibble 0x4/0x5) into types::PpgReading events — 3 samples per channel (ambient, infrared, red) at 64 Hz.

Firmware is detected automatically at connect time — no configuration is required. See the README for a full protocol comparison.

§Quick start

use muse_rs::prelude::*;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = MuseClient::new(MuseClientConfig::default());
    let (mut rx, handle) = client.connect().await?;
    handle.start(false, false).await?;

    while let Some(event) = rx.recv().await {
        match event {
            MuseEvent::Eeg(r) => println!("EEG ch{}: {:?}", r.electrode, r.samples),
            MuseEvent::Disconnected => break,
            _ => {}
        }
    }
    Ok(())
}

§Using as a library dependency

Add to your Cargo.toml:

[dependencies]
# Full build (includes the ratatui TUI feature):
muse-rs = "0.1.0"

# Library only — skips ratatui / crossterm compilation:
muse-rs = { version = "0.1.0", default-features = false }

§Module overview

ModulePurpose
preludeOne-line glob import of the most commonly needed types
muse_clientBLE scanning, connecting, and the muse_client::MuseHandle command API
typesAll event and data types produced by the client
protocolGATT UUIDs, sampling constants, and BLE wire-format helpers
parseLow-level byte-to-sample decoders for EEG, IMU, PPG, and Athena packets

Modules§

muse_client
parse
Binary decoders for Muse BLE notification payloads.
prelude
Convenience re-exports for downstream crates.
protocol
GATT UUIDs, sampling constants, and BLE wire-format helpers for Muse headsets.
types