util.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:urnn 作者: stwisdom 项目源码 文件源码
def istft_mc(X,hop,dtype=np.float32,nsampl=None,flag_noDiv=0,window=None):
    #assumes X is of shape F x nfram x nch, where F=Nwin/2+1
    #returns xr of shape nch x nsampl
    N=2*(X.shape[0]-1)
    nch=X.shape[2]
    for ich in range(0,nch):
        X0=X[:,:,ich]
        if flag_noDiv:
            x0r=istft_noDiv(X0,hop_length=hop,center=False,window=window,dtype=dtype)
        else:
            x0r=librosa.core.istft(X0,hop_length=hop,center=False,window=window,dtype=dtype)
        if ich==0:
            xr=np.zeros((nch,len(x0r))).astype(dtype)
            xr[0,:]=x0r
        else:
            xr[ich,:]=x0r
    #trim off extra zeros
    nfram=xr.shape[1]
    xr=xr[:,0:(nfram-N)]
    nfram=xr.shape[1]
    xr=xr[:,N:]
    if not nsampl is None:
        xr=xr[:,0:nsampl]
    return xr, N
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号