I'm trying to make two audio samples as similar as possible and my problem is that in one test-case their loudness isn't similar enough.
data1, sr1 = librosa.load(path_1, sr=None)
data2, sr2 = librosa.load(path_2, sr=None)
Here are my plots of data1
and data2
over time (s) - you can see data1
is a bit quieter at the beginning:
I thought I just have to normalize it, but then I realized librosa is already doing that on load
.
So the problem seems to be, that the quieter parts are louder in data2
than in data1
.
That sounds like a compression thing to me, so I tried to compress data1
:
data1, sr1 = librosa.load(path_1, sr=None)
data1 = librosa.mu_compress(data1, quantize=False)
data2, sr2 = librosa.load(path_2, sr=None)
Unfortunately now data1
's quiet parts are too loud.
So I tried to compress data2 too:
data1, sr1 = librosa.load(path_1, sr=None)
data1 = librosa.mu_compress(data1, quantize=False)
data2, sr2 = librosa.load(path_2, sr=None)
data2 = librosa.mu_compress(data2, quantize=False)
But then I'm back where I began...
I hope I made my problem clear ;)
How to compress the sounds the 'smart way' so that they both end up as similar as possible?