如何在Python中读取类似于Matlab audioread的音频文件? [英] How to read a audio file in Python similar to Matlab audioread?
本文介绍了如何在Python中读取类似于Matlab audioread的音频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Python中使用wavefile.read()
将音频文件导入Python.我想要的是读取一个音频文件,其中每个样本都加倍,并与Matlab audioread()
函数类似,规格化为-1.0到+1.0.我该怎么办?
I'm using wavefile.read()
in Python to import a audio file to Python. What I want is read a audio file where every sample is in double and normalized to -1.0 to +1.0 similar to Matlab audioread()
function. How can I do it ?
推荐答案
使用 read 函数的 PySoundFile 包.默认情况下,它将完全返回您的请求:一个numpy数组,其中包含在-1.0
至+1.0
范围内的双精度(Float64
)格式的声音文件样本.
Use read function of the PySoundFile package. By default it will return exactly what you request: a numpy array containing the sound file samples in double-precision (Float64
) format in the range -1.0
to +1.0
.
这篇关于如何在Python中读取类似于Matlab audioread的音频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文