Python frequency detection

The aubio libraries have been wrapped with SWIG and can thus be used by Python. Among their many features include several methods for pitch detection/estimation including the YIN algorithm and some harmonic comb algorithms. However, if you want something simpler, I wrote some code for pitch estimation some time ago and you can take it … Read more

FFT in a single C-file [closed]

Your best bet is KissFFT – as its name implies it’s simple, but it’s still quite respectably fast, and a lot more lightweight than FFTW. It’s also free, wheras FFTW requires a hefty licence fee if you want to include it in a commercial product.

Python Scipy FFT wav files

Python provides several api to do this fairly quickly. I download the sheep-bleats wav file from this link. You can save it on the desktop and cd there within terminal. These lines in the python prompt should be enough: (omit >>>) import matplotlib.pyplot as plt from scipy.fftpack import fft from scipy.io import wavfile # get … Read more

Understanding Matlab FFT example

1) Why does the x-axis (frequency) end at 500? How do I know that there aren’t more frequencies or are they just ignored? It ends at 500Hz because that is the Nyquist frequency of the signal when sampled at 1000Hz. Look at this line in the Mathworks example: f = Fs/2*linspace(0,1,NFFT/2+1); The frequency axis of … Read more

Invertible STFT and ISTFT in Python

Here is my Python code, simplified for this answer: import scipy, pylab def stft(x, fs, framesz, hop): framesamp = int(framesz*fs) hopsamp = int(hop*fs) w = scipy.hanning(framesamp) X = scipy.array([scipy.fft(w*x[i:i+framesamp]) for i in range(0, len(x)-framesamp, hopsamp)]) return X def istft(X, fs, T, hop): x = scipy.zeros(T*fs) framesamp = X.shape[1] hopsamp = int(hop*fs) for n,i in enumerate(range(0, … Read more