FFT analysis vs Audacity

46 Views Asked by At

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 :

enter image description here

And in my tool:

enter image description here

Here is the file I use: http://sendanywhe.re/5YPATLC1

Why the FFT in my tool and Audacity are so different ?

0

There are 0 best solutions below