Documentation
¶
Overview ¶
Package audio provides CGO-free microphone capture and audio-format conversion by shelling out to ffmpeg (with arecord/sox fallbacks on Linux). It produces 16kHz mono WAV, the input format whisper.cpp expects, and is used by the chat /voice shortcut and Telegram voice-message transcription.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter converts arbitrary audio files into Whisper-ready 16kHz mono WAV. It is used to turn Telegram voice notes (OGG/Opus) into a format whisper.cpp can read.
func NewConverter ¶
func NewConverter(cfg config.SpeechToTextConfig) *Converter
NewConverter creates a Converter from the speech-to-text config.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder captures microphone audio into a 16kHz mono WAV file by shelling out to ffmpeg (with arecord/sox fallbacks on Linux), mirroring the candidate-list pattern used by the clipboard text writer. It adds no CGO.
func NewRecorder ¶
func NewRecorder(cfg config.SpeechToTextConfig) *Recorder
NewRecorder creates a Recorder from the speech-to-text config.
func (*Recorder) EnsureAvailable ¶
EnsureAvailable reports whether a microphone capture tool is installed, without recording. It lets callers fail fast (with an actionable error) before prompting the user to speak.
func (*Recorder) Record ¶
Record captures up to maxSeconds of microphone audio and returns the path to a 16kHz mono WAV file. When speech_to_text.silence_timeout is set, ffmpeg recordings stop shortly after the speaker goes quiet instead of always running for the full cap. The caller owns the returned file and should remove it.