Tutorial · Python ยท ~10 min

Batch Separate an Audio Library

Thousands of tracks, four stems each: the catalog-wide separation run.

PythonBatchAPI

Why this matters

Karaoke platforms, remix services, and archives all need stem libraries. Batch separation turns the catalog into stems without a server farm.

Per-track jobs isolate failures and give you a clean report at the end.

How it works

Submit the folder with your stem list; each track returns its stems plus a per-track report.

Submit a job with an input URL (S3, GCS or HTTPS), poll the job URL, and download the rendered output. No GPU, no queues, no ffmpeg builds to babysit.

Code

Python
import requests, time

API = "https://api.mlslabs.io/v1/source-separation/jobs"
headers = {"X-API-Key": "YOUR_API_KEY"}
payload = {"input": "s3://bucket/library/", "stems": ["vocals", "instrumental"], "pattern": "*.wav"}

resp = requests.post(API, json=payload, headers=headers)
job = resp.json()
while job["status"] not in ("succeeded", "failed"):
    time.sleep(3)
    job = requests.get(job["url"], headers=headers).json()

print("Output:", job["output_url"])

Pro tips

  • Lossless sources (WAV/FLAC) for the whole batch if you have them.
  • Deliver stems to a structured bucket path per track.
  • Sample-verify a few tracks per batch for QC.

Pricing note

Usage is metered per minute of media processed; the first tier is free each month. Volume discounts kick in automatically.

FAQ

Common questions

How long does a full library take?

Concurrency-bound; a few thousand tracks typically complete in days.

Can I request different stems per track?

Yes โ€” per-track overrides are supported in the manifest.

What does the report include?

Per-track status, stem URLs, durations, and failure reasons.