nomadkaraoke / python-audio-separator

Easy to use stem (e.g. instrumental/vocals) separation from CLI or as a python package, using a variety of amazing pre-trained models (primarily from UVR)
MIT License
477 stars 82 forks source link

Disable Normalization #94

Closed dj-nuo closed 2 months ago

dj-nuo commented 3 months ago

Hi! Do I understand correctly that there is no way to disable normalization without actually changing library code?

(e.g. setting normalization to 1.0 would lead to vocals & instrumental being increased/decreased in volume in case they are lower/higher than threshold)

beveradb commented 2 months ago

Hey @dj-nuo, sorry for the super slow reply, have been super busy and a bit overwhelmed with day job work over the last month (this is an unpaid hobby project).

No, the amplitude won't ever be increased; see the code here:

https://github.com/nomadkaraoke/python-audio-separator/blob/main/audio_separator/separator/uvr_lib_v5/spec_utils.py#L99

If the normalization threshold is set to 1.0, nothing will happen as the input amplitude can't be more than 1.0.

That said, you do explicitly need to set it to 1.0 if you want to disable normalization, as I deliberately set the default to 0.9 as a way to resolve issues people were having with the output audio sometimes having "pop" sounds which were caused by clipping (amplitude trying to go over the maximum possible and being "clipped" down to 1.0).

So, if you disable the normalization, you might just want to watch out for that and if you hear some of those "pop" sounds it's likely caused by clipping and reducing the amplitude a bit can resolve that.