I try to design a simple tool to analysis frequency from wav file. Here is the simple example I try:
import numpy as np
import wavio
from matplotlib import pyplot as plt
from scipy.fft import fft
input_wav_path = "song.wav"
signal = wavio.read(input_wav_path)
X = fft(signal.data)
sr = signal.rate
N = len(X)
n = np.arange(N)
T = N / sr
freq = n / T
plt.figure()
plt.plot(freq, np.abs(X))
plt.xlabel('Freq (Hz)')
plt.ylabel('FFT Amplitude |X(freq)|')
plt.show()
Here is the wav file I use:
I compare the result to the Frequency analysys in Audacity. In Audacity :
And in my tool:
Here is the file I use: http://sendanywhe.re/5YPATLC1
Why the FFT in my tool and Audacity are so different ?