voice_io
voice_io
¶
Microphone recording with silence detection and audio playback helpers.
Functions¶
record_until_silence
¶
record_until_silence(*, sample_rate: int = _SAMPLE_RATE, silence_threshold: int = _SILENCE_THRESHOLD, silence_seconds: float = _SILENCE_SECONDS, startup_silence_seconds: float = _STARTUP_SILENCE_SECONDS, max_seconds: float = _MAX_RECORD_SECONDS) -> bytes
Record from the default microphone until silence is detected.
Returns raw WAV bytes (16-bit mono). Raises RuntimeError if sounddevice is not installed.
Source code in src/openjarvis/speech/voice_io.py
play_wav
¶
Play raw WAV bytes through the default output device.
If the bytes are a valid WAV file, sample rate is read from the header;
otherwise sample_rate is used as a fallback.