Expand description
Audio capture: the sources, the recordings they write, and the canonical 16 kHz mono format shared by everything that reads them.
RecordingReader builds on every target. Everything that opens a
microphone, a model, or a file is native.
Structs§
- Recorded
Audio - The result of a finished recording: its length and, on a target with a
filesystem, its WAV. A WAV this crate wrote is deleted when its owner
drops. A caller’s own file is only borrowed. A recording ended by
RecordingWriter::finishhas none. - Recording
- What one capture’s writer and readers share: each reader’s queue of unread samples, the count written, and how capture ended. It keeps no history: a sample lives only in the queues of readers yet to take it.
- Recording
Reader - A window onto a recording, readable while capture is still writing it.
One reader;
RecordingReader::forkadds another. - Recording
Writer - The write end of a
Recording. - Resampler
- Converts mono f32 audio at any sample rate to canonical 16 kHz.
- Silence
Duration - Stop
Signal - The capture-side stop check. Owned by the capture worker, which drops it the moment recording ends — owners can rely on that drop for cleanup.
- Stopper
- A handle that ends a recording from anywhere: clone it, hand it to a
hotkey or UI, call
stop(). - WavReplay
Capture
Enums§
- Capture
Error - Microphone
Error - Recording
Mode - Replay
Pace - How a WAV replay delivers its samples.
Immediatewrites the whole file beforestartreturns.Realtimewrites it at recorded speed, so transcription overlaps capture as on a real press. - Resample
Error - Silence
Duration Error - Spool
Error - WavError
- WavReplay
Error
Constants§
Traits§
- Audio
Capture - A source of canonical 16 kHz mono audio. Each implementation bounds how long a recording runs.
Functions§
- canonical_
duration - How long
samplescanonical samples last. - canonical_
samples - How many canonical samples
durationspans, rounded down. Saturates atu64::MAX. - f32_
from_ pcm16 - read_
wav - Reads every sample of a canonical WAV. Unlike
RecordingReader::from_wav_file, it sets no length limit. - remove_
all_ spools - write_
wav - Writes
samplestopathas a canonical WAV, replacing any file there.