AI & technology
How AI Music Source Separation Works (and Why It Got So Good)
Ten years ago, removing a singer from a finished song was close to impossible. Today a neural network can do it on a laptop in a couple of minutes. This guide explains what changed, how today's models work, and how their quality is measured.
The problem: un-mixing a song
A mix is the sum of many sounds. Recovering the parts from the sum is mathematically "under-determined": countless combinations of signals could add up to the same result. In the famous "cocktail party problem", people solve this effortlessly, picking out one voice in a noisy room, because the brain knows what voices sound like. Separation algorithms need that same kind of prior knowledge.
Before deep learning
Early approaches relied on hand-designed assumptions:
- Stereo position: vocals are usually centred, so subtracting one channel from the other cancels them, along with the bass and drums.
- Repetition: methods such as REPET assumed the accompaniment repeats while the voice varies.
- Matrix factorisation: non-negative matrix factorisation (NMF) modelled a spectrogram as a combination of recurring spectral patterns.
- Harmonic/percussive splitting: sustained tones form horizontal lines on a spectrogram and drum hits form vertical ones, which median filters can separate.
These ideas work in specific cases but break easily, leaving the "watery" artefacts many people associate with old vocal removers.
The deep-learning shift
Neural networks replaced hand-written rules with rules learned from data. Researchers built datasets of songs with their isolated stems. MUSDB18 (150 tracks split into vocals, drums, bass and other) became the standard benchmark. A model sees the mix, guesses the stems, compares the guess with the truth, and adjusts millions of internal parameters to do better next time.
Key open models along the way:
| Model | Year | Approach |
|---|---|---|
| Open-Unmix (Sony/Inria) | 2019 | Spectrogram masks predicted by recurrent (LSTM) networks |
| Spleeter (Deezer) | 2019 | Fast U-Net spectrogram masking with 2, 4 or 5 stems; brought separation to the mainstream |
| Demucs (Meta AI) | 2019 | Worked directly on the waveform, preserving sharp transients |
| Hybrid Demucs | 2021 | Combined waveform and spectrogram branches |
| HTDemucs (Demucs v4) | 2022 | Added a cross-domain transformer between the two branches |
| BS-RoFormer / Mel-RoFormer | 2023–24 | Transformers over frequency bands; topped the music track of the 2023 Sound Demixing Challenge |
Two ways to see sound: masks and waveforms
Spectrogram masking models turn audio into a time-frequency grid with the short-time Fourier transform, then predict a "mask" for each source. That's a value per grid cell saying how much of that cell belongs to the vocals, the drums, and so on. Multiplying the mix by each mask and converting back gives the stems.
Waveform models work on the raw sample values directly. They're better at keeping phase and sharp attacks intact, so drums stay punchy, but they have to learn frequency structure themselves.
HTDemucs, which powers this site's Vocal Remover and Stem Splitter, does both. One U-Net branch processes the waveform and another processes the spectrogram. In the middle, a transformer lets the two branches attend to each other across several seconds of music, so the model can use context such as "this phrase was sung a bar ago". The outputs of both branches are added together for each stem.
How quality is measured
Researchers report the signal-to-distortion ratio (SDR): how much of the estimated stem is the true source compared with everything else (bleed from other instruments plus artefacts), in decibels. Every additional ~3 dB roughly halves the relative error energy. HTDemucs scores around 9 dB on average on the MUSDB18-HQ benchmark, and the latest RoFormer systems report higher scores, especially for vocals.
SDR is useful, but ears matter more. Two stems with the same score can sound different: one with faint bleed, another with "underwater" artefacts. That's why it's worth listening to your results in context.
Running AI in a web browser
Until recently, separation meant installing Python tools or uploading songs to a cloud service. Two web technologies changed that:
- ONNX, a portable format for neural networks, lets a model trained in PyTorch run in other environments, including browsers via ONNX Runtime Web.
- WebGPU gives web pages access to the graphics card, which performs the matrix multiplications neural networks need far faster than the processor can.
Full Audio Tools downloads the HTDemucs model once (about 180 MB), stores it in your browser, and runs it on your own GPU. Your music never leaves your device. The trade-off is that very large models, such as the biggest RoFormer variants, are still too heavy for most browsers.
Current limits
- Overlapping sounds (a sax and a voice on the same note) remain hard to split cleanly.
- Low-bitrate sources contain compression artefacts that confuse models.
- Stem definitions are fixed by the training data: four-stem models put guitars and keys together in "other".
Frequently asked questions
Is AI stem separation perfect?
No. Even the best models leave small amounts of bleed or artefacts, but modern results are good enough for practice, remixing and most creative work.
What's the best AI model for separating vocals?
On research benchmarks, band-split RoFormer models currently score highest for vocals. HTDemucs remains an excellent all-round four-stem model and is light enough to run in a browser.
Does AI separation need the internet?
Only to download the model the first time. After that, processing runs entirely on your device.