Menu

1 / 2

How to Build a Discord Bot that Splits Audio Stems with Python (2026)

DEV Community·StemSplit·6 months ago
#82BApQRv
#python#discord#api#file#stemsplit
Reading 0:00
15s threshold

Discord has 500 million users. Most bots stream music from YouTube. This one splits it into stems — vocals, drums, bass, and instrumentals — and drops download links straight into your DMs.

Here's the full walkthrough: slash command, file upload, async API job, polling loop, and a result embed that would make your server's musicians happy.

What You'll Learn

✅ How to create a /split slash command with discord.py 2.x app_commands

✅ How to accept audio file uploads through Discord interactions

✅ How to call the StemSplit REST API and poll for async job completion

✅ How to DM the user individual stem download links when the job finishes

✅ How to handle file size limits, API errors, and Discord's 3-second interaction timeout

✅ A working docker-compose.yml to deploy it anywhere

Prerequisites

pip install "discord.py>=2.4" requests python-dotenv

Enter fullscreen mode

Exit fullscreen mode

You need three things:

A Discord bot token — create a bot at discord.com/developers/applications , enable the…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.