Optionaloptions: RealtimeRecordingOptionsWhether any non-empty frame was captured.
The wall-clock moment Start stamped, or null if never started.
Append a user-input audio frame. Same contract as AppendOutbound.
Append a model-output audio frame (ArrayBuffer of little-endian PCM16). No-op if not recording or empty. The bytes are copied — the caller's ArrayBuffer is not retained.
Mix everything captured into a mono PCM16 WAV.
The encoded buffer, duration, and sample rate; or null if HasAudio is false.
Compute capture-time waveform peaks from the accumulated PCM: a normalized 0..1 max-abs
amplitude per bucket (one bucket per rendered waveform bar). Mirrors the client-direct peak
math so server-bridged recordings render the same kind of waveform; the result is persisted
as a peaks.json sidecar so a viewer renders the waveform without re-decoding the audio.
Desired bucket count (waveform resolution). Default 600; clamped to >= 1 and
never exceeds the sample count (a short recording yields at most one peak per sample).
A bounded array of normalized 0..1 peaks; [] when there is no audio (or silence).
ms since Start per the injected clock; 0 if not started (never negative).
Clear all state so the instance can be reused.
Stamp t0 and begin accepting frames. Idempotent (second call is a no-op).
Stop accepting frames. Idempotent. Does NOT clear buffers.
Accumulates realtime PCM audio frames from both the model (outbound) and the user (inbound) and mixes them into a single mono PCM16 WAV on demand.
Lifecycle: construct → Start → AppendOutbound/AppendInbound (many) → Stop → EncodeWav. Reset returns the instance to a pristine state so it can be reused.