swharden/FftSharp

Test FFTmagnitude() and FFTpower() against Python/Numpy

swharden opened this issue · 1 comments

EDIT: I had a moment where I was worried about how FFTmagnitude() calculated its values, but I was reassured all is well by calculating identical values with numpy and matplotlib. I added these comparisons as new tests to ensure FftSharp output remains identical to numpy.

I added new tests to confirm the output of this Python code is identical to the equivalent calls using FftSharp:

sampleRate = 48_000
samplePeriod = 1.0 / sampleRate
N = len(values)
fft = np.fft.fft(values)
fftFreq = np.fft.fftfreq(N, samplePeriod)
fftReal = np.fft.rfft(values)
fftMag = np.abs(fftReal) * 2 / N
fftMag[0] = np.abs(fftReal[0]) / N # special case for DC
fftDB = 20 * np.log10(fftMag)