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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14Windows x86

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

discord_ext_songbird-0.4.2-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.2-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.2-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.2-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.2-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.2-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.2-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.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

Hashes for discord_ext_songbird-0.4.2.tar.gz
Algorithm Hash digest
SHA256 d702d0cd0c44ff8e1ca28502763a91c3d9431d63c3d075b68bc174271d34e732
MD5 d94d958873d2ade8ba22d0f4b4c3a82a
BLAKE2b-256 4c1e3f0230c19aaae81128d95208894af3fc865aa5aeacf91dfea9b995f0e17a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3ddc105c20def7ba503f0507bb08548ea4ef4311873b75daf7f7260974fe5429
MD5 7dd6b09b89cecfbb67478876bb2c5ca5
BLAKE2b-256 8adf1c50f2eecb607b12bf30512f46505a26d77ef1ecf71547fd1cfe25ad10a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 566627a75a54ebad21abcd3ba4de293706ba1508f4e13429dc9c5d3d77b36afc
MD5 a1d731ea073fa2a41e3cff8e49832996
BLAKE2b-256 92e0024833c39974dab8a1b8a6141087f8a9f9ab43cfe48e414ed2eddd505d43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b8f21a3dfff153065afa37fedc129fa01a9eb16951cbc50512cff74c52132ff1
MD5 1ea0f0711424ac9e4bf387218f3b4f6b
BLAKE2b-256 6425cae1d1a67240d07fffef50a496d54805948e780da41d4200b3b227dbf210

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fe4f08f255299092c1ba7147c1fcf6e280ad0fa74cce54809a58b10f82130ef3
MD5 18576eb3cac6d637628fa7791f047107
BLAKE2b-256 2a0b5bea323ae21768d0a7a2c4a37deb2493e74b737bb638fb8576e40824a270

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6c9997583742ac0e48f9b14dbd7dcc724cfcf8b4551991a522a0f05287681170
MD5 ea0d7867d4b55de1c9e1bbd141c4ec0f
BLAKE2b-256 4651ce31258f9439c05882be7cfef21915696f5753b9b1d5763e581627e16c0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 7f8c42428e434df024327aab52409a80819bfd7c0dbb43b21759146aad51bcc9
MD5 3fa385c3cf5bfa177644bbece1b415a0
BLAKE2b-256 e81b6dd672f47dcc93e26adf3c1798911ee453138151cc66ed9b6da1c676a537

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 aeef6072d71302bcaf4f45b5928968be5f21f5427e6822071066846204e8ef34
MD5 ba62eec62ee4de1a4df72c0d4708b8f3
BLAKE2b-256 cbd25a020c783098f2cbcc05a2463b12026bab231063bd4ec12c34995e14bddc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b6b556dbfa81a5118ebae1664dcfb90af0e759e25be1a5184f32a07eae48f6ca
MD5 8e0fa235f0d466a438926070edfd9e94
BLAKE2b-256 c13d433c116fd76ef10763f97459c93c6dea05485028de5083b216460936bc3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 774f2c6e191387866391958db19d5a84324fe657523240f5fb4ae4fb0061c6e4
MD5 c8404ac67969fc6ad445879f14ab1162
BLAKE2b-256 5b72a0a78c01d6f48326d35371880221a4627f5161fc8c9c2cb781b589a6dc50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d4417964414aaa5bbcc55208e69645596bd7007657316253bebf800d3b20f32a
MD5 e15a34cd5eb7ee5c365a8a2d8a678fe3
BLAKE2b-256 3434a6cd770f679a218906d9906f79057099acc5e12c5314fd94a033f6c5295c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 8e05c33354901f8ba22d8db22b0e541460acdada06cfc7a9b2b6b404fafdb076
MD5 9d631c036053bf93532ee4564a91031c
BLAKE2b-256 1f592ac564ad31046ebcc9c2c28b308bc658c6c270f8f2167dc2dfc8f7b1bebe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 34f32d43eb85582f3a4e0b344c0249263af28592f0e12188323978792b5fec84
MD5 26f9c8cab8e72c6d575e3d95145db51e
BLAKE2b-256 e742d8d8417a81ded8bb22fcbe0d439382582c025b2f46c4dcd64071fd607a3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 af988ed081a9f9f79b983810d49ea949b5889becab17217e895aa99fca6b0074
MD5 ef087233b4ddf53c2eeca65e29f243b1
BLAKE2b-256 7273c87b0c142c496624001bc4b6e7ac3384e86bc73b48aad7e39fdb20d47a64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af2d048d541efac06fc5a4028b5160206ac9254653aa441fba897179a6961360
MD5 e2a3624468910f7292c01823a355c7ab
BLAKE2b-256 2e1052d48d2af015056d3804e2bd05df85dc10ba65a1c58e8783a4cfb0b220ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 1cda6c12ee0536b8a8420089b70dfc49a2ef93042910fa140ab2c388eea1a205
MD5 676a7092c25b25aa666c2deedbf80cb8
BLAKE2b-256 8a1455ff42efce7d47e96c5f6d785f2ec3848b8b5dae479ad09d11a5ae1b21ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 6ca5ccbb6569c8beab8a2bd07da75de0448918205f11e0ff283164cdb3337b26
MD5 f9ac082545509ae4cb93e55021ff485c
BLAKE2b-256 c24c2382fd55321d3ba545af43a82f041a76508bdcc313e47a63347e9c9ddf54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2e796047769050bfadc71a2471c0f75db06f01ae9f54d6d6bae7b0c92ce1153c
MD5 7d623bdc59585cff49d7489bc6b5c500
BLAKE2b-256 9f021a57ca8d18822e7376075829648b5d231add1f341c194c7a7a1e2a644484

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discord_ext_songbird-0.4.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6a87ab33ef386c67dbfd39437edc39b4a6eaff867fc3deac794effdb5d1c976
MD5 26151210f6d1dacdab42eecf8db85659
BLAKE2b-256 8a92853f5e0705e873267b825657bb7de5b993407ab3971f6f04aef3ceb60fe5

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