I am trying to calculate the FFT of a signal stored in a WAV file using SciPy. I found a solution here, but it seems like we need to perform this step before the FFT:
b=[(ele/2**8.)*2-1 for ele in a] # this is 8-bit track, b is now normalized on [-1,1)
where the signal samples are stored in array a
. Can someone explain the significance of this step?
Thanks.
Answer
It seems that the WAV file used in that example has samples with values between 0 and 255 (likely stored as unsigned chars). The normalization step just changes the samples to floating point values in the range [-1,1). This is, strictly speaking, not necessary to perform the FFT, but it is a good idea. For instance, it removes the large DC component that results from interpreting the unsigned char values as actual signal amplitudes.
No comments:
Post a Comment