Expand description
Songbird is an async, cross-library compatible voice system for Discord, written in Rust. The library offers:
- A standalone gateway frontend compatible with serenity and twilight using the
"gateway"
and"[serenity/twilight]"
plus"[rustls/native]"
features. You can even run driverless, to help manage your lavalink sessions. - A standalone driver for voice calls, via the
"driver"
feature. If you can create aConnectionInfo
using any other gateway, or language for your bot, then you can run the songbird voice driver. - Voice receive and RT(C)P packet handling via the
"receive"
feature. - SIMD-accelerated JSON decoding via the
"simd-json"
feature. - And, by default, a fully featured voice system featuring events, queues, seeking on compatible streams, shared multithreaded audio stream caches, and direct Opus data passthrough from DCA files.
§Intents
Songbird’s gateway functionality requires you to specify the GUILD_VOICE_STATES
intent.
§Examples
Full examples showing various types of functionality and integrations can be found in this crate’s examples directory.
§Codec support
Songbird supports all codecs and formats provided by Symphonia (pure-Rust), with Opus support provided by audiopus (an FFI wrapper for libopus).
By default, Songbird will not request any codecs from Symphonia. To change this, in your own project you will need to depend on Symphonia as well.
# Including songbird alone gives you support for Opus via the DCA file format.
[dependencies.songbird]
version = "0.5"
features = ["builtin-queue"]
# To get additional codecs, you *must* add Symphonia yourself.
# This includes the default formats (MKV/WebM, Ogg, Wave) and codecs (FLAC, PCM, Vorbis)...
[dependencies.symphonia]
version = "0.5"
features = ["aac", "mp3", "isomp4", "alac"] # ...as well as any extras you need!
§Attribution
Songbird’s logo is based upon the copyright-free image “Black-Capped Chickadee” by George Gorgas White.
Re-exports§
pub use crate::driver::Driver;
driver
pub use crate::events::CoreEvent;
driver
pub use crate::events::Event;
driver
pub use crate::events::EventContext;
driver
pub use crate::events::EventHandler;
driver
pub use crate::events::TrackEvent;
driver
pub use discortp as packet;
driver
andreceive
pub use serenity_voice_model as model;
driver
pub use crate::serenity::*;
serenity
Modules§
- constants
- Constants affecting driver function and API handling.
- driver
driver
- Runner for a voice connection.
- error
- Driver and gateway error handling.
- events
driver
- Events relating to tracks, timing, and other callers.
- id
- Newtypes around Discord IDs for library cross-compatibility.
- input
driver
- Raw audio input data streams and sources.
- join
gateway
- Future types for gateway interactions.
- serenity
serenity
- Compatibility and convenience methods for working with serenity.
Requires the
"serenity"
feature. - shards
gateway
- Handlers for sending packets over sharded connections.
- tracks
driver
- Live, controllable audio instances.
Structs§
- Call
gateway
- The Call handler is responsible for a single voice connection, acting as a clean API above the inner state and gateway message management.
- Config
- Configuration for drivers and calls.
- Connection
Info - Parameters and information needed to start communicating with Discord’s voice servers, either with the Songbird driver, lavalink, or other system.
- Iter
gateway
- An iterator over all
Call
s currently stored in the manager instance. - Songbird
gateway
- A shard-aware struct responsible for managing
Call
s.