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.0.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.0-cp314-cp314-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

discord_ext_songbird-0.4.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0.tar.gz.

File metadata

  • Download URL: discord_ext_songbird-0.4.0.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.0.tar.gz
Algorithm Hash digest
SHA256 bbb315c13802dd533e8198fe0a26a78da8dcf33e4d290a0c84c1d1e338aa150e
MD5 6ce7f4db872584ec7b056be97de68098
BLAKE2b-256 76b2a039ca44ffaf881aa7baf602a645b7e4c49f1d8bae22ddcccbc30ef79d64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 cd6e52e310b3131141e706547864963f7bbd286e363a940dd623b04ab378979f
MD5 4240b5bf986a887033988184641b7bcf
BLAKE2b-256 620d717badebe7bb3fe0c4b174f22c1f016d5b8a5393dea9e18d779ce0f42798

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 2ffa7f554b20e2308e792740a7a980271c05cbf97bbc96ac22bc60f72e705e58
MD5 a19a02f4347103cfb601d40556842676
BLAKE2b-256 dde8d0e3e1520e06ed15a180b7175ccf70ef3a9834707e265a5aaa607e6d801e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e6d5c0611b18723f18ee3b584247810606a0d3f2299aa1bac1a0b9f4aae4375d
MD5 aeb594486d056dc736b5f41315d84985
BLAKE2b-256 2693616e651b47ba0cb070da143c3d6258a3bc6addbda8648107b244a0301cb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4595ce5c754d94f89f99464dd4b109b7cec1fefc1e95b0b170a5dedb0f7d4064
MD5 d19bb773648eaf3af6a6f9e98c9216fc
BLAKE2b-256 c2f4113e213fc517084d5924713f844bc658d2756944c02f0af9e937ac5b62f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 239ce752e4f95abc65a9d4cabff1c77e4d2b4ee57b8a879d3add7c19aea8eb82
MD5 dcf9d275291888f0109aec1c0ef8654e
BLAKE2b-256 0d5cf69bace5bca0ac95f85693365a2c2cc2e96964e768ec2e441916b8330aa7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 2dc8f65004bfa41d87bfef44af82349c1119231066f4d9835e9bdbc14d70a3ed
MD5 f1ffb88c0f7ea5c7fb4353322e83bdf5
BLAKE2b-256 a302b1015350bf6efec1b491451890378293ed4ddc61792fda12f55be3832d37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 01fbd9ecfdabf29491174faa30d92c62b7184d235d99e926930d272f43f7324c
MD5 10affd4f24c1d7a26364a2d45832876f
BLAKE2b-256 7246987785f8a5ed3f688daf7c78bc6be5fc921c67860969fb68986b7b0182a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3bef231e42ea98d664a3f3c8f76f960ff8cc9a1e1424a31d55f6c8885303e63e
MD5 a11d7d2c49545a415aca7f78196f5677
BLAKE2b-256 4cde5e8d6749bc55c9e156f7a2fd06d63163d42f506222f61a3a7e3b17975949

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7cc9edee8fd2f5955a5839167409571c0d49d1a676b5593810303a7b5aabd0f4
MD5 344bd721c698197aea85b16dcd69012d
BLAKE2b-256 ab7ef7bd7c161082ccddad853e7276dc4a6048c7fdecfecbcb0122a8e356a792

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7f03b07d7230a9a51d2aaab0ac357dc5df4da9eeabc00dd404e92d4985aa79de
MD5 6979bd6f2ae64685a621a73327590a03
BLAKE2b-256 d29c9836c00bd11172aba975b70fb49d9a3d49b883f301e06530ff9ac4284301

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 6a8ab8c52487b1e86676313e375ff859ca25ebeccf7c089c5d9424a4005f01e2
MD5 9f4a66483ad1476da96fcbd2723d1048
BLAKE2b-256 7d871afe5dd92c4f4f5a990ace0a1bc4d0bd6682f4699dd066af9e5f34dbd3a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d611ee9126912b9a4f93cc4746f17e75d034ad42f45f5aa7a078ff75687305cd
MD5 6084d18d36e3e97d92e2b69af8b32053
BLAKE2b-256 04aeaaeaad7d9b8e718e27b32595eb5e97e5f69ae6307fa5a2c78760bd232320

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fa976b237be66fb8588972e6ab931f21d0bb1e8909be1ee6f2f1760e7e1172ec
MD5 fb52acfbd8af70f6f01559bbf7c024ac
BLAKE2b-256 61758a393091e94a27e19cab3e58c780889688341281c398b5d62c8f9516a7f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d3340f074bbfc5796ed4521081141d0d4944868fead3c0be89a678801df35f0a
MD5 0864b9e40e9a51fff4f72367569dc5ff
BLAKE2b-256 4b1edd976a38f53c605d741e7ef8571dbf3cd9490175dd16e34c812ba2f2e0d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 0add6dc05962c28d7758a90b8bd1b4574852cfa10bf3fc451c089f449f82431a
MD5 f1759c6a8a7130f52ade477b423ee4a2
BLAKE2b-256 fde5dd76e03e492630e997888decc4f4f77e34aa11455ce2f198ff32a26c9ee8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 911f69a505d4c75b4a03160f8cbf359b60fc24d58e7cda595973df415032f50a
MD5 52a676214236dc1e2fcf90ee1b89bae3
BLAKE2b-256 08890ea43ae77bdcb373b6e4ae190b2c23448966b69d02df06dbd14a1cf08c9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c8c8accf4d5d77e709f423e965e37a788252d82e2e3188f670ce67e924f97acb
MD5 39a0a0ecb96ba62ee6bb87938728d28a
BLAKE2b-256 8f278cb80b6f9fedfe90fca83e28d6d159d8a0914c9fab388ba87d30198bac55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49ca04812be06c444799728dfb1dfe8b4002870cc843efc2afb9d7375e6a28f7
MD5 f831e210b23ac5bc4a3e1045ed861319
BLAKE2b-256 e205204bbc75d28c2ead58d599d38d5970ed5e53d1929c64b60eb26dbecf5212

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