Volume compensation for (old) MDX v2 models
How to automate calculation of volume compensation value for all older MDX models
(results are not perfect and need to be fine-tuned)
by jarredou
So, I have maybe a protocol to find accurate volume compensation:
- Use a short .wav file of just noise (I've used pink noise here) and pass it through the model you wanna evaluate
- Take the resulting audio, the one that will have all the noise in it and compare it to the original noise with this little python script that will give you the difference in dBTP and the quivalent VC ratio (you'll need to
pip install librosa
if you don't have it installed already). The results I've found with it are coherent with the ones you've found by ears ! (1.035437 for HQ2 / 1.022099 for KimFT other)
Here's the script :
import numpy as np
import argparse
import librosa
def Diff_dBTP(file1,file2):
y1, sr1 = librosa.load(file1)
y2, sr2 = librosa.load(file2)
true_peak1 = np.max(np.abs(y1))
true_peak2 = np.max(np.abs(y2))
difference = 20 * np.log10(true_peak1 / true_peak2)
print(f"Diff_dBTP : The difference in true peak between the two audio files is {difference:.6f} dB.")
ratio = 10 ** (difference / 20)
print(f"The volume of sound2 is {ratio:.6f} times that of sound1.\n")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Find volume difference of two audio files.")
parser.add_argument("file1", help="Path to original audio file")
parser.add_argument("file2", help="Path to extracted audio file")
args = parser.parse_args()
Diff_dBTP(args.file1, args.file2)
Volume compensation values for various models (in reality they may differ +/- e.g. by 0.00xxxx, but maybe not much more)
All values according to the script made by **jarredou**
*(All default but Spectral Inversion - Off; Denoise Output: On; - the latter shouldn't affect the results if turned off)*:
- Kim Vocal_1 - 1.012819
- Kim Vocal 2 - 1.009
- voc_ft - 1.021
- Kim ft other - 1.020 (Bas' fine-tuned and SDR-validated)
- UVR-MDX-NET 1 - 1.017194
- UVR-MDX-NET Inst 2 - 1.037748
- UVR-MDX-NET Inst 3 - 1.043115
- UVR-MDX-NET Inst HQ 1 - 1.052259
- UVR-MDX-NET Inst HQ 2 - 1.047476
- UVR-MDX-NET Inst Main - 1.037812 (actually it turned out to be 1.025)
- UVR-MDX-NET Main - 1.002124
- UVR-MDX-NET-Inst_full_292 - 1.056003
- UVR-MDX-NET_Inst_82_beta - 1.088610
- UVR-MDX-NET_Inst_90_beta - 1.151219 (wtf)
- UVR-MDX-NET_Main_340 - 1.002742
- UVR-MDX-NET_Main_406 - 1.001850
- UVR-MDX-NET_Main_427 - 1.002091
- UVR-MDX-NET_Main_438 - 1.001799
- UVR_MDXNET_9482 - 1.007059
"denoise is just processing twice with the second try inverted, after separation reinverted, to amplify the result, but remove the noise introduced by MDX, and then deamplified by 6dbs, so it still the same volume, just without MDX noise.
Basically HV noise removal trick"