Tutorial · Python · ~8 min
How to Separate Vocals from Background Music in Python
Split a voiceover (or a song) into clean vocal and instrumental tracks in five minutes. No CUDA, no GPU, no model weights — sample audio included.
Step 1 — Get your API key
- Sign up (free tier included)
- Copy the key from the dashboard
- pip install mlslabs
Step 2 — Pick a sample
Cloud samples, no upload needed: voiceover-with-bgm.mp3 (speech mode), pop-mix.mp3 (music mode), noisy-meeting.wav (speech + denoise).
Step 3 — Submit a separation job
Python
import mlslabs
client = mlslabs.Client("YOUR_API_KEY")
job = client.vocal_separator.submit(
input_url="s3://bucket/voiceover-with-bgm.mp3",
output_url="s3://bucket/stems/",
mode="speech", # speech | music
tracks=["vocals", "instrumental"],
)
print(job.job_id)Step 4 — Poll for results
Python
import time
while True:
job = client.vocal_separator.get(job.job_id)
if job.status == "done":
break
if job.status == "failed":
raise SystemExit("job failed — credits auto-refunded")
time.sleep(2)Step 5 — Download and verify
Bash
curl -L -o vocals.wav <vocals_url>
curl -L -o instrumental.wav <instrumental_url>
# A/B listen: vocals should be free of music bed artifactsStep 6 — Go further
- Batch process a whole episode library with webhooks
- Chain with ASR: cleaner speech, better transcripts
- Feed clean vocals into a dubbing pipeline
Keep exploring