serenity-rs / songbird

An async Rust library for the Discord voice API
ISC License
391 stars 111 forks source link
discord discord-api hacktoberfest rust voice-support

docs-badge next-docs-badge build badge guild-badge crates.io version rust badge

Songbird

Songbird is an async, cross-library compatible voice system for Discord, written in Rust. The library offers:

Intents

Songbird's gateway functionality requires you to specify the GUILD_VOICE_STATES intent.

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.4"
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.2"
features = ["aac", "mp3", "isomp4", "alac"] # ...as well as any extras you need!

Dependencies

Songbird needs a few system dependencies before you can use it.

This is a required dependency. Songbird cannot work without it.

This is an optional dependency for users, but is required as a dev-dependency. It allows Songbird to download audio/video sources from the Internet from a variety of webpages, which it will convert to the Opus audio format Discord uses.

Examples

Full examples showing various types of functionality and integrations can be found in this crate's examples directory.

Contributing

If you want to help out or file an issue, please look over our contributor guidelines!

Attribution

Songbird's logo is based upon the copyright-free image "Black-Capped Chickadee" by George Gorgas White.