You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every batch, the amplitudes are min-max normalized to the batch.
def__batch_quantize(data, q_levels, q_type):
""" One of 'linear', 'a-law', 'mu-law' for q_type. """data=data.astype('float64')
data=__normalize(data)
. . .
def__normalize(data):
"""To range [0., 1.]"""data-=data.min(axis=1)[:, None]
data/=data.max(axis=1)[:, None]
returndata
This is bad for three reasons:
First reason: DC offset. The normalization is calculated by subtracting the minimum and dividing by the maximum. If minimum peak and maximum peak are different, silence is no longer the middle value, so you introduce a DC offset into the audio.
Second reason: Each batch has different peaks, so each batch will have a different quantization value for silence.
Third reason: dynamics. let's say part of my dataset is soft, part is loud, and part is transitions between soft and loud. If randomly there's a batch of all soft sounds, they will be normalized to loud, interfering with SampleRNN's ability to learn transitions from loud and soft.
Problem
Every batch, the amplitudes are min-max normalized to the batch.
This is bad for three reasons:
First reason: DC offset. The normalization is calculated by subtracting the minimum and dividing by the maximum. If minimum peak and maximum peak are different, silence is no longer the middle value, so you introduce a DC offset into the audio.
Second reason: Each batch has different peaks, so each batch will have a different quantization value for silence.
Third reason: dynamics. let's say part of my dataset is soft, part is loud, and part is transitions between soft and loud. If randomly there's a batch of all soft sounds, they will be normalized to loud, interfering with SampleRNN's ability to learn transitions from loud and soft.
Solution
Dont batch normalize amplitudes.
Take this line out
sampleRNN_ICLR2017/datasets/dataset.py
Line 127 in d1d77d7
I think the only acceptable amplitude normalization would be to the entire dataset and you could do so [with ffmpeg] when creating the dataset.
The text was updated successfully, but these errors were encountered: