A powerful Discord bot that streams system audio directly to voice channels, perfect for tabletop RPG sessions, music sharing, and collaborative listening experiences.
- ✨ Features
- 🚀 Quick Start
- 📋 Prerequisites
- 🛠️ Installation
- 🤖 Bot Registration
- ⚙️ Configuration
- 📚 Usage
- 🎯 Use Cases
- 🔧 Troubleshooting
- 🤝 Contributing
- 📄 License
- 🎵 System Audio Streaming: Stream any system audio directly to Discord voice channels
- 🎮 Perfect for D&D: Share ambient music, sound effects, and audio during tabletop sessions
- 🌍 Multi-language Support: Commands work in English, Ukrainian, and Russian
- ⚡ Dual Interface: Both slash commands and mention-based natural language commands
- 🔄 Auto-disconnect: Automatically leaves empty voice channels to save resources
- 📊 Status Monitoring: Real-time status and connection information
- 🛡️ Error Handling: Robust error handling with user-friendly messages
- 🎚️ Audio Controls: Start, stop, and manage audio playback easily
| Feature | Our Bot | Typical Music Bots |
|---|---|---|
| System Audio | ✅ Stream any application | ❌ Limited to music files/URLs |
| Real-time Audio | ✅ Live system capture | ❌ Pre-recorded content only |
| D&D Integration | ✅ Perfect for ambient sounds | |
| Multi-language | ✅ EN/UK/RU support | ❌ English only |
| Local Control | ✅ Stream local applications | ❌ External sources only |
| Low Latency | ✅ Optimized for real-time |
- Create virtual audio device (see Installation)
- Register Discord bot (see Bot Registration)
- Install dependencies:
uv sync - Set environment: Create
.envwith your bot token - Run:
uv run main.py
- Python 3.9+
- FFmpeg (for audio processing)
- Virtual Audio Cable (OS-specific)
- Discord Bot Token
- uv package manager (recommended) or pip
| OS | CPU | RAM | Additional |
|---|---|---|---|
| Linux | Any x64 | 512MB+ | PulseAudio |
| Windows | Any x64 | 512MB+ | Virtual Audio Cable |
| macOS | Any x64/ARM | 512MB+ | Soundflower/BlackHole |
# Ubuntu/Debian
sudo apt update
sudo apt install ffmpeg pulseaudio pavucontrol
# Arch Linux
sudo pacman -S ffmpeg pulseaudio pavucontrol
# Fedora
sudo dnf install ffmpeg pulseaudio pavucontrol# Create the virtual audio sink
pactl load-module module-null-sink sink_name=discord_sink sink_properties=device.description=DiscordSink
# Make it permanent (add to PulseAudio config)
echo "load-module module-null-sink sink_name=discord_sink sink_properties=device.description=DiscordSink" >> ~/.config/pulse/default.pa
PulseAudio Volume Control configuration
- Open PulseAudio Volume Control:
pavucontrol - Go to Playback tab
- Set applications you want to share to output to "DiscordSink"
- The bot will capture this audio automatically
# Using uv (recommended)
uv venv
source .venv/bin/activate
uv sync
# Using pip
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- Download VB-Audio Virtual Cable
- Install and restart your computer
- You'll see "CABLE Input" and "CABLE Output" in your audio devices
# Using Chocolatey
choco install ffmpeg
# Or download from https://ffmpeg.org/download.html
# Add to PATH environment variable- Control Panel → Sound → Playback
- Set applications you want to share to output to "CABLE Input"
- Update bot configuration to use Windows audio source:
# In main.py, update AUDIO_CONFIG
AUDIO_CONFIG = {
"format": "s16le",
"channels": 2,
"sample_rate": 48000,
"source": "dshow:audio=\"CABLE Output (VB-Audio Virtual Cable)\""
}# Using uv
uv venv
.venv/Scripts/activate.ps1
uv sync
# Using pip
python -m venv .venv
.venv/Scripts/activate.ps1
pip install -r requirements.txtBlackHole audio driver configuration
# Install BlackHole (recommended)
brew install blackhole-2ch
# Alternative: Soundflower (legacy)
brew install soundflowerbrew install ffmpeg- Open Audio MIDI Setup (
/Applications/Utilities/) - Create Multi-Output Device including BlackHole
- Set applications to output to this device
- Update bot source to:
"BlackHole 2ch"
# Using uv
uv venv
source .venv/bin/activate
uv sync
# Using pip
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Discord Developer Portal - New Application
- Go to Discord Developer Portal
- Click "New Application"
- Enter your bot name (e.g., "Audio Streamer Bot")
- Accept ToS and create
- Go to "Bot" section
- Copy the Token (keep it secure!)
- Enable "Message Content Intent"
https://discord.com/oauth2/authorize?client_id=YOUR_BOT_ID&permissions=3148800&scope=bot%20applications.commands
Replace YOUR_BOT_ID with your application ID from the General Information page.
Create a .env file in your project root:
# Discord Bot Token (required)
TOKEN=your_discord_bot_token_here
# Optional: Custom audio source
AUDIO_SOURCE=discord_sink.monitor
# Optional: Logging level
LOG_LEVEL=INFOEdit the AUDIO_CONFIG dictionary in main.py:
AUDIO_CONFIG = {
"format": "s16le", # Audio format
"channels": 2, # Stereo
"sample_rate": 48000, # Discord's preferred rate
"source": "discord_sink.monitor" # Your virtual audio device
}| Command | Description |
|---|---|
/connect |
Connect to your voice channel |
/play |
Start streaming system audio |
/stop |
Stop audio playback |
/disconnect |
Leave voice channel |
/status |
Show bot status and connection info |
You can also control the bot by mentioning it with natural language:
@MusicBot connect
@MusicBot підійди сюда (Ukrainian: "come here")
@MusicBot play music
@MusicBot включи музику (Russian: "turn on music")
@MusicBot disconnect
@MusicBot уйди (Russian: "go away")
Natural language mention commands
| Action | English | Ukrainian | Russian |
|---|---|---|---|
| Connect | connect, join, in | сюда, підійди | подключись |
| Play | music, play, start | гра, музику, грай | включи |
| Disconnect | disconnect, leave, out, exit, stop | лівні | уйди, отключись |
- Ambient Music: Stream atmospheric music during gameplay
- Sound Effects: Play combat sounds, environmental audio
- Voice Modulation: Use with voice changers for NPCs
- Background Audio: Tavern sounds, dungeon ambience
Example Workflow:
- Set your media player to output to virtual cable
- Join voice channel with players:
/connect - Start streaming:
/play - Control music/sounds from your media player
- Players hear everything in real-time
- Local Music Library: Share your personal music collection
- Streaming Services: Share from Spotify, YouTube, etc.
- Live Audio: Stream microphone input, instruments
- Podcast Listening: Listen to podcasts together
- Game Audio: Share game sounds and music
- Commentary: Stream while playing games
- Tutorials: Audio guides and explanations
- Collaboration: Share audio during development
- Screen Recording Audio: Share system audio during presentations
- Music Background: Add background music to meetings
- Audio Demos: Demonstrate audio applications
- Training Sessions: Share instructional audio
Symptoms: Bot connects but no audio is heard
Solutions:
- Check Virtual Cable: Ensure virtual audio device is created
pactl list sinks | grep discord_sink # Linux
- Verify Audio Routing: Applications must output to virtual cable
- Test FFmpeg: Run FFmpeg command manually
ffmpeg -f pulse -i discord_sink.monitor -f s16le -ac 2 -ar 48000 test.wav
Symptoms: Connection errors or timeouts
Solutions:
- Check Permissions: Bot needs Connect and Speak permissions
- Voice Channel Limit: Ensure channel isn't full
- Bot Status: Use
/statusto check connection state
Symptoms: FileNotFoundError or audio processing errors
Solutions:
- Install FFmpeg: Ensure FFmpeg is in PATH
ffmpeg -version # Should show version info - Update Audio Source: Check virtual device name
- Try Alternative Sources:
# Linux alternatives "default" # Default audio device "alsa_output.pci-0000_00_1f.3.analog-stereo.monitor"
Solutions:
- Reduce Buffer Size: Lower the bufsize parameter
- Close Unused Applications: Free up system resources
- Check Sample Rate: Ensure 48000 Hz (Discord standard)
Enable debug logging:
# Add to main.py
logging.basicConfig(level=logging.DEBUG)- Check Logs: Review console output for errors
- Test Components: Verify FFmpeg, virtual audio, bot permissions
- Update Dependencies: Ensure latest versions
- Community Support: Join our Discord server [link]
This project is licensed under the MIT License - see the LICENSE file for details.
- Discord.py - Excellent Discord API wrapper
- FFmpeg - Powerful multimedia framework
- PulseAudio/VB-Cable - Virtual audio solutions
- Community - Thanks to all contributors and users!
⭐ Star this repository if you found it helpful!
🐛 Report Bug • ✨ Request Feature
Made with ❤️ for the D&D and music sharing community




