我正在尝试使用Pydub库从 mp3 文件中生成带有G. 711 alaw压缩的 wav 文件。wav 文件正在生成,但未重新采样到频率 8 kHz。我试过以下代码:
from_path = '/home/nikhil/Music/m1.mp3' #this is a mp3 file
to_path = '/home/nikhil/Music/m1.wav' #resulted file
from_format = 'mp3'
to_format = 'wav'
params = ["-acodec", "pcm_alaw", "-ar", "8000"]
AudioSegment.from_file(from_path, from_format).export(to_path, format=to_format, parameters=params)
有人能帮我吗?