def GLA(wsz, hop, N=4096):
""" LSEE-MSTFT algorithm for computing the synthesis window used in
inverse STFT method below.
Args:
wsz : (int) Synthesis window size
hop : (int) Hop size
N : (int) DFT Size
Returns :
symw: (array) Synthesised windowing function
References :
[1] Daniel W. Griffin and Jae S. Lim, ``Signal estimation from modified short-time
Fourier transform,'' IEEE Transactions on Acoustics, Speech and Signal Processing,
vol. 32, no. 2, pp. 236-243, Apr 1984.
"""
synw = hamming(wsz)/np.sqrt(N)
synwProd = synw ** 2.
synwProd.shape = (wsz, 1)
redundancy = wsz/hop
env = np.zeros((wsz, 1))
for k in xrange(-redundancy, redundancy + 1):
envInd = (hop*k)
winInd = np.arange(1, wsz+1)
envInd += winInd
valid = np.where((envInd > 0) & (envInd <= wsz))
envInd = envInd[valid] - 1
winInd = winInd[valid] - 1
env[envInd] += synwProd[winInd]
synw = synw/env[:, 0]
return synw
评论列表
文章目录