【问题标题】:What are Python3 libraries which replace "from scikits.audiolab import Format, Sndfile"什么是 Python3 库替换“从 scikits.audiolab 导入格式,Sndfile”
【发布时间】:2020-04-07 19:23:35
【问题描述】:

希望你会做得很好。我是 python 新手。我正在尝试在 python3 版本中使用 audio.scikits 库。我在 2.7(with audio.scikits) 中有一个工作代码版本。当我使用 python3 版本运行时,我收到 Import Error: No Module Named '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 执行此操作。

【问题讨论】:

    标签: python-3.x speech-to-text microsoft-cognitive scikits


    【解决方案1】:

    首先你粘贴的链接代码是Asterisk-Google-Speech-Recognition,不是Microsoft-Speech-To-Text,如果你想获得Microsoft-Speech-To-Text的样本可以参考官方文档:Recognize speech from an audio file

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-30
      • 1970-01-01
      • 1970-01-01
      • 2018-01-15
      • 1970-01-01
      • 2010-09-19
      • 1970-01-01
      • 2021-12-17
      相关资源
      最近更新 更多