Library to replace the voice backend of discord.py with Songbird.
Project description
discord-ext-songbird
High-performance voice backend for discord.py, powered by Songbird and written in Rust.
discord-ext-songbird provides a native VoiceProtocol implementation for discord.py, exposing
Songbird's Rust audio pipeline through PyO3.
Highlights
- Drop-in
VoiceProtocolviaSongbirdClient - Low-latency playback backed by Songbird
- Voice receive APIs (
BufferSink,StreamSink) - Native input types for raw PCM, encoded audio, and streaming
- PyO3/maturin extension with Python 3.13+ support
- Beta release series (API may evolve)
Installation
pip install discord-ext-songbird
uv add discord-ext-songbird
Quickstart
import pyarrow as pa
import discord
from discord.ext import songbird
from discord.ext.songbird import player
client = discord.Client(intents=discord.Intents.default())
@client.event
async def on_ready():
channel = client.get_channel(int(CHANNEL_ID))
if isinstance(channel, discord.VoiceChannel):
vc = await channel.connect(cls=songbird.SongbirdClient)
samples = pa.array([0.0, 0.1, 0.0, -0.1], type=pa.float32())
source = player.input.RawPCMInput(samples, sample_rate=48000, channels=2)
track = player.Track(source).volume(0.8)
await vc.play(track)
client.run(DISCORD_BOT_TOKEN)
Features
Playback
Use SongbirdClient as your voice client. Playback is driven by Track and TrackHandle.
from discord.ext import songbird
from discord.ext.songbird import player
vc = await channel.connect(cls=songbird.SongbirdClient)
track = player.Track(source)
handle = await vc.play(track)
handle.pause()
Inputs
Native input types live under discord.ext.songbird.player.input.
RawPCMInput:pyarrow.Float32ArrayPCM inputAudioInput: encoded audio in apyarrow.Arraywith aSupportedCodecStreamInput:asyncio.StreamReaderwith aSupportedCodec
Supported codecs: MP3, WAVE, MKV, FLAC, AAC.
import asyncio
from discord.ext.songbird import player
buffer = asyncio.StreamReader()
source = player.input.StreamInput(buffer, player.input.SupportedCodec.AAC)
track = player.Track(source)
Voice receive
Receive decoded PCM via BufferSink or StreamSink.
from discord.ext.songbird import receive
sink = receive.BufferSink(max_duration_secs=5)
vc.listen(sink)
async for tick in sink:
pcm = tick.get(receive.VoiceKey.User(user_id))
if pcm is not None:
handle_pcm(pcm)
VoiceTick.get() returns pyarrow.Int16Array (PCM).
Examples
See examples/ for runnable bots:
examples/basic.py(PCM playback)examples/send_stream.py(stream input)examples/receive_stream.py(voice receive)
Set DISCORD_BOT_TOKEN and CHANNEL_ID before running the examples.
Requirements
- Python 3.13+
discord.py[voice]pyarrow
Development
uv sync --all-extras --dev --no-install-project
uvx maturin develop
just build
just fmt
just check
Contributing
Issues and pull requests are welcome. Please keep changes focused and avoid committing build artifacts.
License
MIT. See LICENSE.
Acknowledgements
- Songbird (Rust voice library)
- discord.py (Python Discord API wrapper)
- PyO3 (Rust bindings for Python)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discord_ext_songbird-0.4.2.tar.gz.
File metadata
- Download URL: discord_ext_songbird-0.4.2.tar.gz
- Upload date:
- Size: 101.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d702d0cd0c44ff8e1ca28502763a91c3d9431d63c3d075b68bc174271d34e732
|
|
| MD5 |
d94d958873d2ade8ba22d0f4b4c3a82a
|
|
| BLAKE2b-256 |
4c1e3f0230c19aaae81128d95208894af3fc865aa5aeacf91dfea9b995f0e17a
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ddc105c20def7ba503f0507bb08548ea4ef4311873b75daf7f7260974fe5429
|
|
| MD5 |
7dd6b09b89cecfbb67478876bb2c5ca5
|
|
| BLAKE2b-256 |
8adf1c50f2eecb607b12bf30512f46505a26d77ef1ecf71547fd1cfe25ad10a8
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-win32.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-win32.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.14, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
566627a75a54ebad21abcd3ba4de293706ba1508f4e13429dc9c5d3d77b36afc
|
|
| MD5 |
a1d731ea073fa2a41e3cff8e49832996
|
|
| BLAKE2b-256 |
92e0024833c39974dab8a1b8a6141087f8a9f9ab43cfe48e414ed2eddd505d43
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.14, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8f21a3dfff153065afa37fedc129fa01a9eb16951cbc50512cff74c52132ff1
|
|
| MD5 |
1ea0f0711424ac9e4bf387218f3b4f6b
|
|
| BLAKE2b-256 |
6425cae1d1a67240d07fffef50a496d54805948e780da41d4200b3b227dbf210
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.14, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe4f08f255299092c1ba7147c1fcf6e280ad0fa74cce54809a58b10f82130ef3
|
|
| MD5 |
18576eb3cac6d637628fa7791f047107
|
|
| BLAKE2b-256 |
2a0b5bea323ae21768d0a7a2c4a37deb2493e74b737bb638fb8576e40824a270
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.14, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c9997583742ac0e48f9b14dbd7dcc724cfcf8b4551991a522a0f05287681170
|
|
| MD5 |
ea0d7867d4b55de1c9e1bbd141c4ec0f
|
|
| BLAKE2b-256 |
4651ce31258f9439c05882be7cfef21915696f5753b9b1d5763e581627e16c0d
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_s390x.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_s390x.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.14, manylinux: glibc 2.28+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f8c42428e434df024327aab52409a80819bfd7c0dbb43b21759146aad51bcc9
|
|
| MD5 |
3fa385c3cf5bfa177644bbece1b415a0
|
|
| BLAKE2b-256 |
e81b6dd672f47dcc93e26adf3c1798911ee453138151cc66ed9b6da1c676a537
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_ppc64le.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_ppc64le.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.14, manylinux: glibc 2.28+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeef6072d71302bcaf4f45b5928968be5f21f5427e6822071066846204e8ef34
|
|
| MD5 |
ba62eec62ee4de1a4df72c0d4708b8f3
|
|
| BLAKE2b-256 |
cbd25a020c783098f2cbcc05a2463b12026bab231063bd4ec12c34995e14bddc
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.14, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6b556dbfa81a5118ebae1664dcfb90af0e759e25be1a5184f32a07eae48f6ca
|
|
| MD5 |
8e0fa235f0d466a438926070edfd9e94
|
|
| BLAKE2b-256 |
c13d433c116fd76ef10763f97459c93c6dea05485028de5083b216460936bc3e
|
File details
Details for the file discord_ext_songbird-0.4.2-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
774f2c6e191387866391958db19d5a84324fe657523240f5fb4ae4fb0061c6e4
|
|
| MD5 |
c8404ac67969fc6ad445879f14ab1162
|
|
| BLAKE2b-256 |
5b72a0a78c01d6f48326d35371880221a4627f5161fc8c9c2cb781b589a6dc50
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4417964414aaa5bbcc55208e69645596bd7007657316253bebf800d3b20f32a
|
|
| MD5 |
e15a34cd5eb7ee5c365a8a2d8a678fe3
|
|
| BLAKE2b-256 |
3434a6cd770f679a218906d9906f79057099acc5e12c5314fd94a033f6c5295c
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-win32.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-win32.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.13, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e05c33354901f8ba22d8db22b0e541460acdada06cfc7a9b2b6b404fafdb076
|
|
| MD5 |
9d631c036053bf93532ee4564a91031c
|
|
| BLAKE2b-256 |
1f592ac564ad31046ebcc9c2c28b308bc658c6c270f8f2167dc2dfc8f7b1bebe
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34f32d43eb85582f3a4e0b344c0249263af28592f0e12188323978792b5fec84
|
|
| MD5 |
26f9c8cab8e72c6d575e3d95145db51e
|
|
| BLAKE2b-256 |
e742d8d8417a81ded8bb22fcbe0d439382582c025b2f46c4dcd64071fd607a3f
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af988ed081a9f9f79b983810d49ea949b5889becab17217e895aa99fca6b0074
|
|
| MD5 |
ef087233b4ddf53c2eeca65e29f243b1
|
|
| BLAKE2b-256 |
7273c87b0c142c496624001bc4b6e7ac3384e86bc73b48aad7e39fdb20d47a64
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af2d048d541efac06fc5a4028b5160206ac9254653aa441fba897179a6961360
|
|
| MD5 |
e2a3624468910f7292c01823a355c7ab
|
|
| BLAKE2b-256 |
2e1052d48d2af015056d3804e2bd05df85dc10ba65a1c58e8783a4cfb0b220ce
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_s390x.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_s390x.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cda6c12ee0536b8a8420089b70dfc49a2ef93042910fa140ab2c388eea1a205
|
|
| MD5 |
676a7092c25b25aa666c2deedbf80cb8
|
|
| BLAKE2b-256 |
8a1455ff42efce7d47e96c5f6d785f2ec3848b8b5dae479ad09d11a5ae1b21ca
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_ppc64le.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_ppc64le.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ca5ccbb6569c8beab8a2bd07da75de0448918205f11e0ff283164cdb3337b26
|
|
| MD5 |
f9ac082545509ae4cb93e55021ff485c
|
|
| BLAKE2b-256 |
c24c2382fd55321d3ba545af43a82f041a76508bdcc313e47a63347e9c9ddf54
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e796047769050bfadc71a2471c0f75db06f01ae9f54d6d6bae7b0c92ce1153c
|
|
| MD5 |
7d623bdc59585cff49d7489bc6b5c500
|
|
| BLAKE2b-256 |
9f021a57ca8d18822e7376075829648b5d231add1f341c194c7a7a1e2a644484
|
File details
Details for the file discord_ext_songbird-0.4.2-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: discord_ext_songbird-0.4.2-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6a87ab33ef386c67dbfd39437edc39b4a6eaff867fc3deac794effdb5d1c976
|
|
| MD5 |
26151210f6d1dacdab42eecf8db85659
|
|
| BLAKE2b-256 |
8a92853f5e0705e873267b825657bb7de5b993407ab3971f6f04aef3ceb60fe5
|