0
$\begingroup$

I am developing a chord recognition program using neural networks.I need to normalize the spectrogram or my pitch class profile to provide inputs for the neural network. The pitch class profile classifies the frequency into 12 class semitones (From note A to G).

The problem here is it produces really high values and low values: they can be on the order of ten, one million, or even a trillion. Meanwhile, the input values for the neural network should be between 1 and -1.

What is a normalization formula that I can use to transform the values to be between 1 and -1?

$\endgroup$

2 Answers 2

1
$\begingroup$

Audio volume is usually measured in decibels (a logarithmic scale) precisely because there's such a wide range of input energies. But in your case, it's unlikely that you need volume at all. What you need is relative volume: what fraction of the total energy in the signal is in each FFT bin? Since the energy in each FFT bin is positive, it follows that the relative contribution of each FFT bin is strictly in the range [0,1]. Multiply by 2, subtract 1, and you're in the correct range. And as a bonus, the extremes of the range are quite unlikely in practice.

$\endgroup$
0
$\begingroup$

Well if you know what a reasonable min/max range of the output of your spectogram will be then you can just remap the range, see this se question. Otherwise you'll need to have some sort of clipping method that maps values greater than X to 1. Example: >1 trillion = 1, 0 = -1, and remap the ranges between 0 to 1 trillion onto the range of -1 to 1. You could also convert the spectogram output into decibels which will effectively compress the output range to something like -60 to 100 dB. These are generally typical ranges in dB for the output of a spectogram. Note that taking the log will make the output nonlinear, I'm not sure if that will have any negative effects on your neural network.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.