Expand description
Audio in and out for loqui.
Out: synthesized speech is encoded as WAV (16-bit PCM), FLAC, Ogg Opus
or raw 16-bit PCM, the formats an OpenAI-compatible /audio/speech client asks
for. In: uploaded audio in any common container (WAV, FLAC, MP3, Ogg
Vorbis or Opus, WebM/Opus, MP4/AAC) is decoded, mixed to mono and
resampled for Whisper. Everything here is pure Rust.
Structs§
- Pcm
- Mono audio: samples in
[-1, 1]atrateHz.
Enums§
Constants§
- WHISPER_
RATE - The sample rate Whisper consumes.
Functions§
- decode
- Decodes any supported container to mono at its native rate. With
max_secs, stops withError::TooLongas soon as the audio exceeds it. - decode_
mono_ 16k - What Whisper wants: mono, 16 kHz, clamped to
[-1, 1]. - encode
- resample
- Resamples to
targetHz with a band-limited FFT resampler.