[Bug]: MDX models: vocals scaled down by the input's peak when the input peak is below normalization_threshold , leaving voice in the instrumental stem
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- machine-learning
Direzione di ricerca
Start in separator/architectures/mdx_separator.py, in separate(), where peak is computed, the mix goes through spec_utils.normalize, and the output is multiplied by peak. Reproduce with a quiet input (peak around 0.35) using an MDX model such as Kim_Vocal_2.onnx, and check whether the vocal and instrumental stems sum back to the input level. Done when the gain applied by normalize is undone correctly, so the stems match the original scale, and the Roformer/MDXC results still hold.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Title: MDX models: vocals scaled down by the input's peak when the input peak is below normalization_threshold, leaving voice in the instrumental stem
Version: audio-separator 0.48.0, onnxruntime 1.31.1 (CPU), torch 2.11.0+cpu, Python 3.12.3, Linux x86_64
Summary
In separator/architectures/mdx_separator.py, separate() does:
peak = np.abs(mix).max() # line 168
mix = spec_utils.normalize(wave=mix, max_peak=self.normalization_threshold,
min_peak=self.amplification_threshold) # line 169
source = self.demix(mix) * peak # line 172
...
self.secondary_source = (-self.primary_source * self.compensate) + mix.T # line 195
normalize() only rescales the mix when its peak is above max_peak (0.9 by default), or below min_peak. For any input whose peak lies between those two values, the mix is passed through unchanged, but the result is still multiplied by peak. The primary (vocal) stem is therefore scaled down by the input's own peak. Because the secondary stem is mix - primary * compensate, the missing part of the voice ends up in the instrumental.
Reproduction
Any quiet speech or vocal file with a peak of about 0.3–0.5, separated with an MDX model (Kim_Vocal_2.onnx or UVR-MDX-NET-Voc_FT.onnx):
- A talk excerpt with peak 0.355 gave vocals exactly 9.0 dB below the input level (20·log10 0.355 = −9.0).
- On plain speech with no music, the instrumental stem was only 3.8 dB below the original. It should be near silence.
- The instrumental was 99.4% correlated with the vocal stem: it was essentially
(1 − peak) / peak × vocals. - Rescaling the same file to peak 1.0 before separation, so the multiplication becomes
× 1, fixed it. Vocals were then −0.2 dB from the input, and the instrumental −19.3 dB, matching BS-Roformer on the same audio.
Roformer and MDXC models go through a different code path and were not affected in our tests.
Expected
The stems sum back to the input at its original level, whatever the input loudness.
Suggested fix
Keep the gain that normalize() actually applied, and undo exactly that gain, for example:
peak_in = np.abs(mix).max()
mix_norm = spec_utils.normalize(wave=mix.copy(), max_peak=self.normalization_threshold,
min_peak=self.amplification_threshold)
gain = (np.abs(mix_norm).max() / peak_in) if peak_in > 0 else 1.0
source = self.demix(mix_norm) / gain
...
self.secondary_source = (-self.primary_source * self.compensate) + mix.T # original-scale mix
An alternative is to always normalise to unit peak before demix and multiply by peak afterwards, as the current code seems to assume.
Workaround for users
Rescale the input to peak exactly 1.0, pass normalization_threshold=1.0, and scale both output stems back by the original peak. Use float WAV input and use_soundfile=True, so the output keeps float format and nothing clips.
Have you searched for existing issues? 🔎
- I have searched and found no existing issues.
- Lingua principale
- Python
- Stelle
- 1.5k
- Fork
- 216
- Merge medio
- 1h
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nomadkaraoke/python-audio-separator
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nomadkaraoke/python-audio-separator#292 · 2 commenti ·
-
Confusing info in READMEForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
nomadkaraoke/python-audio-separator#246 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di nomadkaraoke/python-audio-separator
Issue simili
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
jirikuncar/sqlty#1454 ·
I maintainer di solito rispondono entro 1 giorno
-
approved-direction help wanted kind/bug stage/010-actionable triage/accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
projectbluefin/testsuite#1329 ·
I maintainer di solito rispondono entro 1 giorno
-
Tests: tests/mcp/server.test.ts fails on Windows when Microsoft Store python3 alias is presentApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno