我正在尝试在 python 2.6 中将 16khz wav 文件下采样到 8khz。该文件具有 RIFF header 并且采用 mulaw 格式,并且必须保留该格式。
我浏览了 this big list of python stuff 中的一些内容并且似乎无法找到一个简单的库来改变音频文件的采样率。
有没有关于一个好的 python 库的建议?
请您参考如下方法:
我最终安装了 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)
