Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # x is the input signal
- # STFT
- fftsize = 8192; overlap = 4; hop = fftsize / overlap
- w = scipy.hamming(fftsize)
- x_stft = scipy.array([scipy.fft(w*x[i:i+fftsize]) for i in range(0, len(x)-fftsize, hop)])
- # ISTFT
- w /= sum([w[hop * i] ** 2 for i in range(overlap)]) # normalize for perfect reconstruction
- y = scipy.zeros(len(x))
- for n,i in enumerate(range(0, len(x)-fftsize, hop)):
- y[i:i+fftsize] += scipy.real(scipy.ifft(x_stft[n])) * w # overlap-add
- # y is the output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement