Python3 库取代了 "from scikits.audiolab import Format, Sndfile" 是什么

What are Python3 libraries which replace "from scikits.audiolab import Format, Sndfile"

希望你一切顺利。我是 python 的新手。我正在尝试在 python3 版本中使用 audio.scikits 库。我在 2.7(with audio.scikits) 中有一个工作代码版本。虽然我是 运行 python3 版本,但我收到 导入错误:没有名为 'Version' 的模块错误。我知道 python3 不再支持 audio.scikits(如果我没记错的话)。任何人都可以建议我替换 audio.scikits 的库,在那里我可以使用 audio.scikits 之类的所有功能或任何其他可能对我有帮助的解决方案。提前致谢。

2.7版本号:

from scikits.audiolab import Format, Sndfile
from scipy.signal import firwin, lfilter

array = np.array(all)
fmt = Format('flac', 'pcm16')
nchannels = 1
cd, FileNameTmp = mkstemp('TmpSpeechFile.wav')
# making the file .flac
afile =  Sndfile(FileNameTmp, 'w', fmt, nchannels, RawRate) 
#writing in the file
afile.write_frames(array)
SendSpeech(FileNameTmp)

要查看完整代码,请访问:Google Asterisk Reference Code(modifying based on this code)

我想用 python3 个支持的库修改此代码。我在这里为 Asterisk-Microsoft-Speech To Text SDK 做这个。

首先,您粘贴的 link 代码是 Asterisk-Google-Speech-Recognition,不是 Microsoft-Speech-To-Text,如果您想获取有关 Microsoft-Speech-To-Text 的示例,可以参考官方文档:Recognize speech from an audio file.

关于你说的问题,是的,它并不完全兼容,在github问题中有解决方案,你可以参考这个comment