audio.py 文件源码

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

项目:untwist 作者: IoSR-Surrey 项目源码 文件源码
def read(cls, filename):
        """
        Read an audio file (only wav is supported).

        Parameters
        ----------
        filename: string
            Path to the wav file.
        """
        sample_rate, samples = wavfile.read(filename)
        if samples.dtype==np.dtype('int16'):
            samples = samples.astype(_types.float_) / np.iinfo(np.dtype('int16')).min
        if len(samples.shape)==1:
            samples = samples.reshape((samples.shape[0],1))
        instance = cls(samples, sample_rate)
        return instance
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号