Ahmed Doghri Logo Image
Ahmed Doghri

restem

A separator doesn't need retraining to take a second pass. restem's 27.74 dB gain needed the interferer's exact frequency typed into the code. With the frequency estimated from the audio, it holds about 20 dB on frequencies it has never seen.

restem reproduced benchmark result

One Pass Leaves Music on the Vocal

Most source separators make one prediction and stop, even when the output still carries structured leakage that the same separator knows how to recognize.

restem synthesizes a vocal and a backing source, writes their mixture to WAV, and starts from a one-step estimate with measurable backing interference left in it.

Run the Separator Again, Carefully

Each pass estimates the remaining interference and removes a conservative fraction of it. The update is explicit, so you can inspect the improvement curve instead of taking it on faith by ear. It follows the paper's training-free multi-step idea at the signal level, and it isn't pitched as a replacement for Demucs or any learned separator.

The Number

The one-step estimate measures 8.78 dB SNR. Five passes reach 36.52 dB, a 27.74 dB gain. demo/mixture.wav and demo/separated.wav are committed, so you can listen to the result as well as measure it.

The "Known" Basis Was Known to a Fraction of a Hertz

The refinement loop projected the estimate onto the backing tone's exact frequency, 440 Hz, typed into the code. Nothing was estimated. Tell it the interferer is at 439.5 Hz, an error far smaller than any real estimate would carry, and the entire 27.74 dB gain collapses to 0.00 dB. Run more passes at the exact frequency and SNR climbs past 150 dB. That's what linear convergence on a perfectly known basis looks like, not what refinement looks like.

The fix replaces the typed-in frequency with a coarse-to-fine Goertzel search over the mixture itself, a real training-free estimation step instead of an assumption. On 40 tuning seeds and a disjoint 30-seed holdout, each with an interferer frequency the original code never saw, the hardcoded basis gains exactly 0.00 dB every time. The estimated basis gains 21.0 dB on the tuning seeds and 20.5 dB on the holdout, never below 14.6.

Smaller than 27.74, and it's the first version of this number that would survive contact with a recording someone else made. The original module is untouched, and 12 tests pass on GitHub Actions across Python 3.9 through 3.13.

Research Basis

Inspired by the 2025 training-free multi-step separation paper. Every number on this page comes from this repository's own controlled benchmark, not from the paper.

Try It

Standard library only:

git clone https://github.com/ahmeddoghri/restem && cd restem
python restem.py     # the published 27.74 dB, exact 440 Hz basis
python restem_v2.py  # same mixture, frequency estimated from the audio
python eval_v2.py    # 70 unseen frequencies: hardcoded 0 dB, estimated ~20 dB

Then play demo/mixture.wav and demo/separated.wav back to back.

Tools Used

Python
Audio DSP
Source Separation
WAV
Iterative Refinement
Frequency Estimation
unittest