dj.py 文件源码

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

项目:apicultor 作者: sonidosmutantes 项目源码 文件源码
def NMF(stft, n_sources):
    """
    Sound source separation using NMF
    :param stft: the short-time Fourier Transform of the signal
    :param n_sources: the number of sources                                                                         
    :returns:                                                                                                         
      - Ys: sources
    """
    print "Computing approximations"
    W, H = librosa.decompose.decompose(np.abs(stft), n_components=n_sources, sort=True)
    print "Reconstructing signals"
    Ys = list(scipy.outer(W[:,i], H[i])*np.exp(1j*np.angle(stft)) for i in xrange(n_sources))
    print "Saving sound arrays"
    ys = [librosa.istft(Y) for Y in Ys]
    del Ys
    return ys
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号