Skip to main content

Module audio

Module audio 

Source
Expand description

Low-level audio output (capability voice): the bot writes the audio itself instead of naming tracks for Voice’s player. For synthesisers, text to speech, mixers, and formats the bot decodes on its own. Output only: bots never receive members’ audio.

One stream at a time, in the bot’s voice channel; opening it pauses the player and closing it resumes the player. When the buffer runs low the bot gets VoiceEvent::AudioLow, its cue to write more.

use zaun_bot::Audio;
Audio::open_pcm(48_000, 1, Some("Beep"))?;   // UNSUPPORTED on hosts without an encoder
Audio::write_pcm(samples)?;                   // returns the ms buffered; BUSY past 3 s
Audio::close(true);                           // after the buffer has played

Re-exports§

pub use wit::AudioFormat;
pub use wit::PcmFormat;
pub use wit::StreamOptions;

Structs§

Audio
The bot’s audio output stream.