Expand description
Low-level audio output (capability voice): the bot writes the audio itself, packet by
packet or sample by sample, instead of naming tracks for the player. For synthesisers, text
to speech, mixers, and bots that decode formats of their own. Output only: members’ audio is
never delivered to a bot.
One stream at a time, in the bot’s voice channel. Opening it pauses the player (voice);
closing it resumes the player. voice-event.audio-low asks for more, so a bot can write as
it plays without timers.
Structs§
- PcmFormat
- PCM the host encodes to Opus.
- Stream
Options
Enums§
- Audio
Format - How the bot’s audio is encoded.
Functions§
- buffered_
ms - The audio written and not yet played, in ms (0 without a stream).
- clear
- Drops everything buffered at once, keeping the stream open (to interrupt speech).
- close
- Closes the stream: once the buffer has played (
drain), or at once. The player resumes. Nothing happens without a stream. - open
- Opens the stream in the bot’s voice channel, pausing the player.
CONFLICTwhen the bot is in no voice channel or a stream is open;UNSUPPORTEDfor a format the host cannot take;BAD_REQUESTfor a rate, channel count or low-water mark out of range. - write_
opus - Opus packets, for an
opusstream. Returns the audio buffered, in ms;BUSYpast 3 s. - write_
pcm - Interleaved samples, for a
pcmstream; any count (the host frames them). Returns the audio buffered, in ms;BUSYpast 3 s.