Skip to main content

Crate loqui_audio

Crate loqui_audio 

Source
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] at rate Hz.

Enums§

Error
Format
An output format, named as the OpenAI API names it in response_format.

Constants§

WHISPER_RATE
The sample rate Whisper consumes.

Functions§

decode
Decodes any supported container to mono at its native rate. With max_secs, stops with Error::TooLong as soon as the audio exceeds it.
decode_mono_16k
What Whisper wants: mono, 16 kHz, clamped to [-1, 1].
encode
resample
Resamples to target Hz with a band-limited FFT resampler.