Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WAVDurationSeconds ¶ added in v0.184.0
WAVDurationSeconds returns the duration of a RIFF/WAVE file in seconds by reading its fmt and data chunk headers. It lets callers report the duration of synthesized speech without external tools.
Types ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder captures microphone audio into a 16kHz mono WAV file through ffmpeg, with arecord and sox fallbacks on Linux, and adds no CGO. run, runSilence and lookPath are overridable in tests.
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 can be resolved (possibly by downloading ffmpeg), 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.