I have an audio sample, which is sampled at 22k Hz and total samples = 660k , as the duration is 30 seconds. (22k*30 = 660k)
When I plot the fft of the complete sample, I get a symmetric graph with 660k x values, and corresponding y values as shown:
dir = '/media/Data/ubuntu_bkp/genres/blues/'
file="blues.00000.au.wav"
sample_rate, X = scipy.io.wavfile.read(dir+file)
fft=(abs(scipy.fftpack.fft(X)))
plt.plot(fft)
plt.show()
This seems to read as the sound sample has a maximum of 330k Hz frequency, (I have some idea that it repeats after half of the fft transform because of negative and positive frequencies having same values). If I adjust the length the sound sample, the maximum frequency of fft graph changes accordingly (length/2 -> max freq/2):
fft=(abs(scipy.fftpack.fft(X[:len(X)/2])))
plt.plot(fft)
plt.show()
which shouldn't happen as frequency is independent of length of sample.
Any advice? I am unable to grasp this.
Aucun commentaire:
Enregistrer un commentaire