SHARE
TWEET

Untitled

a guest Dec 3rd, 2013 395 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # x is the input signal
  2.  
  3. # STFT
  4. fftsize = 8192;  overlap = 4;  hop = fftsize / overlap
  5. w = scipy.hamming(fftsize)  
  6. x_stft = scipy.array([scipy.fft(w*x[i:i+fftsize]) for i in range(0, len(x)-fftsize, hop)])
  7.  
  8. # ISTFT
  9. w /= sum([w[hop * i] ** 2 for i in range(overlap)])   # normalize for perfect reconstruction  
  10. y = scipy.zeros(len(x))
  11. for n,i in enumerate(range(0, len(x)-fftsize, hop)):
  12.   y[i:i+fftsize] += scipy.real(scipy.ifft(x_stft[n])) * w    # overlap-add
  13.  
  14. # y is the output
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top