/** * Local microphone capture for push-to-talk voice input. * * Spawns an external recorder binary (sox/rec or ffmpeg) to capture audio * from the system microphone into a temporary WAV file. Audio is recorded as * 16kHz mono PCM, which is what speech-to-text models expect. * * The capture lifecycle is: detect a recorder once, start() spawns the process, * stop() signals the process to finish and resolves with the recorded buffer. */ export type RecorderKind = 'sox' | 'ffmpeg' | 'pipewire' | 'pulse' | 'alsa'; export interface RecorderInfo { kind: RecorderKind; /** Resolved binary name used to spawn the recorder. */ bin: string; } /** * Detect an available recorder binary on the host (Linux/macOS). * * On Linux, prefer native recorders that ship with common desktop audio stacks * (PipeWire's `pw-record`, PulseAudio's `parecord`, ALSA's `arecord`) so most * users need no extra install. macOS has no reliable built-in CLI recorder, so * it falls back to sox/ffmpeg. Both also fall back to sox/ffmpeg if present. * * Returns null if nothing usable is installed. */ export declare function detectRecorder(): RecorderInfo | null; /** * A single in-progress microphone recording. */ export declare class MicRecording { private proc; private outputPath; private recorder; private stderr; private exited; private resolveExited; private stopped; constructor(recorder: RecorderInfo); /** * Stop recording and return the captured audio as a WAV buffer. * Returns null if recording failed or produced no audio. */ stop(): Promise; /** * Read the audio captured so far, mid-recording, as a playable WAV buffer. * * The recorder is still appending to the file and has not finalized the WAV * header's size fields, so we read the current bytes and patch the RIFF/data * chunk sizes to match what's actually on disk. Returns null if there isn't * enough audio yet to transcribe. */ snapshot(): Buffer | null; /** * Abort recording without returning audio (e.g. on cancel). */ cancel(): void; private cleanup; } //# sourceMappingURL=mic-capture.d.ts.map