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.3.tar.gz (101.7 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.3-cp314-cp314-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

discord_ext_songbird-0.4.3-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.3-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.3-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.3-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.3-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.3-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.3-cp314-cp314-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

discord_ext_songbird-0.4.3-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.3-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.3-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.3-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.3-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.3-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.3-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.3.tar.gz.

File metadata

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

File hashes

Hashes for discord_ext_songbird-0.4.3.tar.gz
Algorithm Hash digest
SHA256 8a09355af57688db9e44445a8af07df826bd4638528cdafe2f544bae170d2d6f
MD5 453829900dd16b1ee6c83f5e790a32d4
BLAKE2b-256 9004079df095ac7a687379fac63b7de198ab2725c30215cde58370951709c4b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 421e9f713c26c35f76ed0885ae0aafa1a0b4c1203c790530d48074fded305292
MD5 090792858da2ed8cd3d4a06cdba2e627
BLAKE2b-256 594dc7d60aa65f752a257329efd62a390d76dd797cec1ff318c6aca0a35d54cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 68846fcdb1f2c7a9c895d81e1484b7b6d7f512917d7d418a533badad57e4567e
MD5 55055563112ffa6363c17ee5ebe67c3f
BLAKE2b-256 2801e9f0b978b16ed6ed3ad93ee5d6ab27574dfa066f4979b8eec99074c398a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 23b6faf79b6cb41a779fca7950efff057e63ec6820e4b182bad3e0fe48767200
MD5 a622c0c480c3a01431c3fdc79a38ac39
BLAKE2b-256 f571198fe737cf1289208a3a612e07663e9dc3e7eca5dabf75ec75bf7ea1eac8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fbc2acb57e382bc53d00c803cfd11da8b0d69e2e7bc3352120e468a8661e2866
MD5 4bb7617170ccc9da2bb6de0a9c775681
BLAKE2b-256 63c0ffc05efc6f729a2ec0d89ac41f8dfa142669230301143eb48e53e4fb6d05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cfe60ec34eeaf42189fc8eac3fa58126ab7fa11768c34b33006e42b22fa3a71e
MD5 649cbbe08121ba3a959e5b84c598ed7d
BLAKE2b-256 16ce260f5f21825402f7f6f1982cbf186739deb81cfc50874f74b491e1e7995e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 b70b1ad267d9e05632bed19d6eec1a9b086f7d52d4eb10924d47cf3fb6efd856
MD5 921b1c7187a0d56774995d47af4dac73
BLAKE2b-256 dc2f00b9567942a77a940fbedb405e00a847432547ab5204bbb8523e760a27c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 c98501a1a251ad21d27594a774a167e53ae39652cc063e4669e1164e7c74179d
MD5 425ea724d5e66ffe1e098afbb398fbc5
BLAKE2b-256 b20e1e39f3805afae1effe5d4cd4f5763e8d534ce201618f2f375032f1f470dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8b2d3d612a8a902395a6314e3e52129def2bd09170cc4f5904183d4a3867ce87
MD5 8e4e6f69a0d3bd9b9f12914b0b3c3673
BLAKE2b-256 5f9f825b1a7c1221cb4dade69b0db99386c13ed396d273ff405a279fe70ea480

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efc53dcbd2c465449bbe8dd4ebcc46221f776818edbbdcbb1c47cc9c022da441
MD5 13d6e91bec9797296fb9cae97917d049
BLAKE2b-256 0eae9adf065692c1d4bc786880a3f46d9121ab05bd7575e55ba31514f140797d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 84d9fed001c1c332d7a5e92072bb2ef8fb89a52419840dd2d2aecd9d437d7880
MD5 e4f6fe9037424c6543e178a6c0c9e145
BLAKE2b-256 61c98ef70f45736d4322adbe9101a1cf213b14c2769455ebb11e5f5081d1a956

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 c121cc4f665991ed98430c724e31005e185195e6a0d2282d52ba8a993f2ad85b
MD5 fbe34de01e652dced365ba6525b1736e
BLAKE2b-256 43390fa080ec3a5ed0a9bcbd9214ccaee72ff15655c83175bb2fd25e7a11a428

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d20d5d8daa01635f35e4cf7e9ae15039c344f871fa00ac32e36aa477632bfe36
MD5 9e95c9f69d23182039a7d60d6323378a
BLAKE2b-256 4696cdae5489803aa8df54d5b4a47ee131835fb40874f6e8431a342ab17826e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b3493e82c31af02b9048793ae1603030cfbbb762b9c6122dc8f847d1d7f66818
MD5 75023f9ed28d80bea5b9fb99845a7145
BLAKE2b-256 5cf2c73660bd87424e79a5797a97a3454e7708022d1c180d4386d11664a8d8ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d6d53d85e5bb88ee6264de9b4a5eb0b74307328174634b8de1a31df421936a7
MD5 a56aebf21b132b9a6f2d24005d7ce1e7
BLAKE2b-256 b27192461d34a666ce9b9698ef9988d4f02f79b3c8cac9fecc06a2e921f8cbba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 42b6e357e45e1a59b0d2e42751d6eddcd011c1b877825347963043d5a24cfc72
MD5 0a0e97b4a73cabd4423b056df54e9223
BLAKE2b-256 b5cc3e1744f2e96776cf8f0922845013943ebc3b224f3bb250b875f776030bb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 fa18bbdf7a78ee3f5d09a8b0a0fcffcdc26279b9d2b5dda0d103916289200b2e
MD5 17a3515169b3965c1f43d846f962b067
BLAKE2b-256 1626a309646393d0155b6e46da2e6e7325388fb1d62ffafe7c8fa3aec6fde1f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c4479087d12d4156c53aed4be221530b6ae3aa034c160ed80b79524c903fe109
MD5 13a58fe563faf91ab5a9614f76ba7ed2
BLAKE2b-256 519ac51d3e7241c1ee4439d9434fc3fbd1d2f8579e1431dc4dd067d410899c39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c542454488a23c6a2c9eae071124f906f3987f55d2c03395dc8012647561115
MD5 ce162344036258a6c14c46186b06a5dd
BLAKE2b-256 bf6e20784658e2fe57eb99000039dbfeb98c5b0a45e7ef8009c50fe6dfa2eb7a

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