Skip to main content

Library to replace the voice backend of discord.py with Songbird.

Project description

discord-ext-songbird

GitHub License GitHub Release PyPI - Version PyPI - Python Version

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 VoiceProtocol via SongbirdClient
  • 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.Float32Array PCM input
  • AudioInput: encoded audio in a pyarrow.Array with a SupportedCodec
  • StreamInput: asyncio.StreamReader with a SupportedCodec

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

discord_ext_songbird-0.4.1.tar.gz (101.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

discord_ext_songbird-0.4.1-cp314-cp314-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.14Windows x86-64

discord_ext_songbird-0.4.1-cp314-cp314-win32.whl (3.1 MB view details)

Uploaded CPython 3.14Windows x86

discord_ext_songbird-0.4.1-cp314-cp314-musllinux_1_2_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

discord_ext_songbird-0.4.1-cp314-cp314-musllinux_1_2_aarch64.whl (4.0 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ ARM64

discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_s390x.whl (3.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ s390x

discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_ppc64le.whl (4.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ppc64le

discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

discord_ext_songbird-0.4.1-cp314-cp314-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

discord_ext_songbird-0.4.1-cp313-cp313-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.13Windows x86-64

discord_ext_songbird-0.4.1-cp313-cp313-win32.whl (3.1 MB view details)

Uploaded CPython 3.13Windows x86

discord_ext_songbird-0.4.1-cp313-cp313-musllinux_1_2_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

discord_ext_songbird-0.4.1-cp313-cp313-musllinux_1_2_aarch64.whl (4.0 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ARM64

discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_s390x.whl (3.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ s390x

discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_ppc64le.whl (4.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ppc64le

discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

discord_ext_songbird-0.4.1-cp313-cp313-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file discord_ext_songbird-0.4.1.tar.gz.

File metadata

  • Download URL: discord_ext_songbird-0.4.1.tar.gz
  • Upload date:
  • Size: 101.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for discord_ext_songbird-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a86310f687db0a7bd40227bdf06ed911848cac75dfa1432e8c217b6d63fbf7b8
MD5 3dfc5011dc973b80b93e184de10c834f
BLAKE2b-256 3b1d80415f74cc6099f3eb442ab3f121688c7fab8e0adad0925c421b092e6146

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 53af3f88af14081766882d2185dd3c42bd59f1a356af078e5e9670ac13a5bbe5
MD5 d8e64ca897f3f14bd264cf268886246e
BLAKE2b-256 5ed6615cb6e310a6acc2d98344fce17737c7a2112d9934d9491bba826335ca79

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-win32.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 9fc5e3cc80dfa1bdb2229c09868cadebd75d715a6634c9c92dfc7a4034be8056
MD5 220674900c027a29b9260de23dfa06a4
BLAKE2b-256 0c958bd00c8db1693f6c818ae66d187a884f1139799842010a90ab267db2ea88

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 07866a5342d05e14fbd4be932cc697abe15a95a8c08e4dc29c7184602a3e8ffe
MD5 6a9e7614fff68fba919da330401c9c8a
BLAKE2b-256 47787f22c17226ed79969efe6f617ca6502e9ba12704caab173bbe9357ce726f

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 2f6e0b6268298d3b607270157dd2d955e2592eade9097da6bc988b7fbfda00cc
MD5 8b35d6f71d22b59d5187b7b195bc9ab7
BLAKE2b-256 76797b397cfe5cea714972086e1fee4336a7ab6c27522e665f9ee56f6e79a0d8

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 79759a583cd9541d4255a8a8d5b34913ba793ae8fa137d85a0dc261a64304d22
MD5 e0f7ab4b97d2d3ecd377bc1f17fd4f87
BLAKE2b-256 ff09b978031354b050c1295521d70e480701c1c510a66e330f929c15daabd942

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_s390x.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 f31a075ef1aba03d9d467e3950f491b7b83e2c2a58d1f54b8594ff6b1e2645b3
MD5 9c9f4ffe450aef0bfd194a71ae1cb628
BLAKE2b-256 b51f203c491e136616f83a7aaab1a0759a19855fe56ba6f56e8e3e9bc537e270

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 69c83a1a89ecc8798fd63d52fbc52ad5eb0e3719c4ca89af1a3e55d4c88e96dd
MD5 79b5082e977b78fa215ad01e3fc55d33
BLAKE2b-256 4e578c5e037ce655eefb8fc9ca09fb55051702b9bf35ee506f2a9523531ba2ac

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ded563d31796b21b15cb09babe919b78ecea49c25babb9b4efe8171c2bf82e33
MD5 d936227739b8f099d7f38624acd1d19f
BLAKE2b-256 0f8850205b932a21a43cd41f91a0fb09e39a5a591834cca6a812f85757cd7174

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fafbd422306e4ef7c39517e5352b20770a8eba6c34bfa9ba935544e21b92c357
MD5 828534023df0946e01b72224a3f32959
BLAKE2b-256 0a5c8b670195dd235d4cda1e32f78240873c31ea9f815cfb14272dddebf06106

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a954d4bb15faedf605aca270c646b18c26bc2da22beb2685be0619bdf29dfb0e
MD5 524b34b1fc40d3e98a7a2358a795fe9e
BLAKE2b-256 ea34b4d008e227e2c040da57a2b7573c05db8c10105e2315458521641a9fdd0a

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-win32.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 63fe325e1a11145999367c493fc5fdc5fcf11111efb851aecae54af578dd3a79
MD5 f207c40e38ed35c35a54e816503f800b
BLAKE2b-256 b175d272599b94c6985964264ad75255854794c79388be5db5e3609661336595

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2fdb37559f5ee242b79e31a9bd84d51742ef3276883d38c1a969fccfd780db4d
MD5 a5d19c00d35b7fb71d1b8791075415c9
BLAKE2b-256 3c618db9f7a0c24d3c009a67d86550ad7147eee4a99b4baa4e9416515cc11f9a

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 58f33fdda1bd7c8fa069f6cf556065cc3363291b5d7a1758c5e7ba6378127ebb
MD5 916e605f0de3130a3edf63867108cc49
BLAKE2b-256 a500197af41e4b9e22359bf0e6fb6e3c876dc414a288ab7ca02a043f9c9972e4

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 01531799042b54f8bb94fa0aa5de5ba3267dd1d7617b78f41eed89e0892a7958
MD5 8e500be9d33cc482f6217e89ffb9ee53
BLAKE2b-256 adaea22630ce2f6a7cf2905c99a8033524cb1662221cd3a6a0cf07f6e8eb83ff

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_s390x.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 0d3796ee347858045abb312b91beb4b1553ad725a81d8a10ced2fc5ce48f6748
MD5 131345a7f6fcb3e201a63169ab2a0ceb
BLAKE2b-256 472d23302209f3c3ecc05394b72aaed4b7fe826e77d1218af61c76d58bbfc167

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 8d3f31a145a2fe64bd54563f17b42a37133fd0a96990714916c970f25da1f1a5
MD5 4a549f7072ccf2c550dc8ffe4165290e
BLAKE2b-256 bcf27b42c4bf91e91422d4af1412a754b83f058a6d19aaad8aa0a1da0c384e19

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8047cd40bb49a43e6dd9b5b22d21dc6eaa642c10b5335269141369e924cb1af6
MD5 2be655c59063dd264e977e9d8caa31ef
BLAKE2b-256 b40b1a11a03891773c861e0eb4104a9ce3c60ee4803c2ebca513dacd463f149d

See more details on using hashes here.

File details

Details for the file discord_ext_songbird-0.4.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16bcefc048e7d906cd765ab3c47da8de448ee512c32c8c87ed85b01b6376c61e
MD5 818426995111d54b28383854791eb34e
BLAKE2b-256 8ab5d3137ee49a2f537d354028309e74b4c2075ccc4aae552d4433cc21bb7545

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page