Tutorial · Python · ~10 min

How to Upmix Stereo Audio to 5.1 Surround in Python

Beyond matrix upmixing: separate first, then place each source in 3D space. No DSP filter chains, no "fake surround".

PythonSpatial audio5.1

Why this works

The principle

Traditional upmixing spreads two channels around the room. AI upmixing splits the mix into sources — vocals, drums, bass, ambience — then renders each source into the surround layout with its own position, depth and gain.

Step 1 — Submit a separation + upmix job

auto placement follows production conventions; manual placement lets you pin each stem yourself.

Python
import mlslabs

client = mlslabs.Client("YOUR_API_KEY")
job = client.source_separation.upmix(
    input_url="s3://bucket/concert-stereo.wav",
    output_url="s3://bucket/upmix-5-1/",
    layout="5.1",           # 5.1 | 7.1.2
    placement="auto",      # auto | manual per-stem
    stems=["vocals", "drums", "bass", "guitar", "ambience"],
)
print(job.job_id)

Step 2 — Poll and download

Python
job.wait()
print(job.status)
# download: multichannel WAV per layout
print(job.files)

Step 3 — Verify the layout

Bash
ffprobe -show_streams upmix-5-1.wav | grep channel_layout
# => 5.1(side)   (6 channels)

Advanced: manual placement

Pin stems by hand for artistic control — for example, vocals locked to center, rain spread to the rear, thunder routed to LFE and surrounds:

placement=[{"stem": "vocals", "pan": "C"}, {"stem": "rain", "pan": "BL+BR"}, {"stem": "thunder", "pan": "LFE+LS+RS"}]

Note: This is the input side of the stereo-to-Atmos pipeline — the AI Mixing API takes the placed stems and renders object-based immersive masters.