EegChunk

class EegChunk(val deviceId: DeviceId, val channels: List<String>, val srate: Int, val samples: FloatArray, val sampleCount: Int, val accel: FloatArray?, val gyro: FloatArray?, val firstSampleIndex: Long, val wireLastSampleIndex: Long, val packetBytes: Int, val hostTimeNs: Long, val isDummy: BooleanArray, val contact: BooleanArray, val batteryPct: Float, val digitalInput: BooleanArray? = null)

A batch of decoded samples from one stream packet — the efficient public unit (one object per packet, not per sample). Channel labels + srate travel with the data so consumers never reconstruct layout by hand.

IMU values are in the physical units the BrainAccess C/Python SDK delivers — the conversion from the wire's raw counts is per hardware generation (DeviceHardware); an EegChunk never carries counts.

Constructors

Link copied to clipboard
constructor(deviceId: DeviceId, channels: List<String>, srate: Int, samples: FloatArray, sampleCount: Int, accel: FloatArray?, gyro: FloatArray?, firstSampleIndex: Long, wireLastSampleIndex: Long, packetBytes: Int, hostTimeNs: Long, isDummy: BooleanArray, contact: BooleanArray, batteryPct: Float, digitalInput: BooleanArray? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

flat [sampleCount * 3] accelerometer x/y/z in m/s², or null when the hardware has no accelerometer (HALO V1/V2). One reading per packet, repeated on each sample.

Link copied to clipboard
Link copied to clipboard

active-channel labels, in column order (length == column count).

Link copied to clipboard

per-active-channel electrode contact (length == channels.size); false = not connected.

Link copied to clipboard
Link copied to clipboard

per-sample level of the headset's digital input (length == sampleCount; ADS chip 0's GPIO1, sampled with each conversion; firmware 3.8.1+), when the stream was started with digitalInput = true; null otherwise. Gap-filled samples read false: nothing is known of a lost sample's input.

Link copied to clipboard

device sample counter of the first sample (gaps detectable).

Link copied to clipboard

flat [sampleCount * 3] gyroscope x/y/z in degrees per second, or null when the hardware has no gyroscope (every board before the V3 generation).

Link copied to clipboard

host monotonic clock at receipt (for sync/LSL).

Link copied to clipboard

per-sample gap-fill marker (length == sampleCount).

Link copied to clipboard

length of the BLE notification payload this chunk was decoded from.

Link copied to clipboard
Link copied to clipboard

flat [sampleCount * channels.size], row-major, µV — or, in impedance mode, device-computed electrode impedance in kΩ (one value per sample; NOT a raw ADC count).

Link copied to clipboard
val srate: Int

the rate the device streams at: DeviceConfig.deviceSrate, which in an impedance mode too slow for the configured rate is 250 Hz.

Link copied to clipboard

the packet footer's device sample counter (unsigned 32-bit LE at packetBytes - 5), exactly as received — never gap-filled, never relabeled; -1 if the packet carried no counter. A value BELOW the previous chunk's marks a late/out-of-order packet: the codec appends that packet's samples at the current cursor, so firstSampleIndex keeps climbing and cannot reveal the reorder — only this raw counter can.

Functions

Link copied to clipboard
fun streaming(sample: Int): Float

C-SDK-parity STREAMING value for sample: 1f when the sample really arrived over the air, 0f when it is a zero-filled gap sample. The inverse of isDummy, named so consumers cannot invert the polarity by accident.