我正在尝试在python2.6中将一个16 8khz的wav文件下采样到8 8khz。该文件具有RIFF标头,并且是mulaw格式,并且必须保持该格式。
我浏览了一下this big list of python stuff中的一些东西,似乎找不到一个简单的库来改变音频文件的采样率。
有没有什么好的python库可以做这件事的建议?
发布于 2013-06-04 02:41:09
我最终安装了sox,然后通过子进程调用它:
from subprocess import Popen, PIPE, STDOUT
soxCall = '/usr/local/bin/sox ' + infileName + \
' ' + outfileName + ' rate 8k'
p = Popen(soxCall, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)发布于 2013-06-01 03:45:14
audioop看起来是专为满足您的需求而设计的。
支持µ法则,看起来可以通过audioop.ratecv调整采样率
https://stackoverflow.com/questions/16864482
复制相似问题