Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. from scipy.io import wavfile
  4. from scipy.linalg import dft
  5. from matplotlib import cm
  6.  
  7.  
  8. L = 1024 # Window size
  9. N = 2048 # Lenght of X
  10. H = 512 # Hop size
  11.  
  12. dft = dft(L)
  13. haan = np.hanning(L)
  14. dft = np.multiply(dft, haan)
  15.  
  16. k = (int(N/H) - 1)*L
  17. A = np.zeros((k,N))
  18. print(A.shape)
  19. # print(A[0:L][0:L].shape)
  20. for i in range((int(N/H) - 1)):
  21.     A[i*L:(i+1)*L, 0:L] = dft
  22.     A[i*L:(i+1)*L, :] = np.roll(A[i*L:(i+1)*L, :], i*H, axis=1)
  23.  
  24. plt.imshow(np.absolute(A), interpolation='None', cmap=cm.coolwarm)
  25. plt.colorbar()
  26. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement