python - Azure 语音到文本 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND)

标签 python azure speech-to-text

我一直在尝试启动一个涉及 azure 语音转文本的项目,出于测试目的,希望用此站点中找到的演示代码来证实其工作原理:

https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-speech-to-text?tabs=windowsinstall%2Cterminal&pivots=programming-language-python .

已将 Microsoft 可再发行组件中的所有必备组件安装到 pip install azure-cognitiveservices-speech .

我已设置默认麦克风。

通过 azure 门户从 azure 认知服务获取我的订阅 key 和区域> 所有资源> 语音资源> key 和端点

但我无法启动演示,因为它抛出错误 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND)

回溯是

Traceback (most recent call last):
  File "c:\Users\user\Desktop\Azure test\test.py", line 26, in <module>
    recognize_from_microphone()
  File "c:\Users\user\Desktop\Azure test\test.py", line 10, in recognize_from_microphone
    speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config)
  File "C:\Users\user\Desktop\Azure test\.env\lib\site-packages\azure\cognitiveservices\speech\speech.py", line 808, in __init__
    self._impl = self._get_impl(impl.SpeechRecognizer, speech_config, audio_config, language, source_language_config, auto_detect_source_language_config)
  File "C:\Users\user\Desktop\Azure test\.env\lib\site-packages\azure\cognitiveservices\speech\speech.py", line 870, in _get_impl
    return reco_type._from_config(speech_config._impl)
RuntimeError: Exception with an error code: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND)

调用堆栈如下

[CALL STACK BEGIN]
    > pal_string_to_wstring
    - pal_string_to_wstring
    - audio_config_get_audio_processing_options
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
[CALL STACK END]

以防万一,我使用的是从 Microsoft Store 购买的 Windows 11 和 Python 3.9.12。

我会发布代码,但它是 html 中找到的代码的字面副本,仅包含在所述位置找到的订阅 key 。

编辑:

我能够使用 javascript 运行相同的示例,但 node.js 仅支持从音频文件到文本,这不是我想要的。

此外, azure 语音到文本确实可以使用 js 与麦克风配合使用,但使用浏览器意味着客户端,但最好这不是我想要的。只是指出这一点作为证明来自 azure 的所有资源都已正确配置,也许这​​与 python 或 pip 包管理器有关,但就像我所说的其他主题中提到的所有 dll 文件都在虚拟环境中,所以它“不应该”一个问题

如果有人可以帮助我,因为我在这里不知所措。

最佳答案

请检查我的发现是否有帮助:

正如您提到的,您正在使用从 Microsoft 商店获取的 Python 3.9.12

同样的问题已在 GitHub 中注册,人们通过切换/使用 Python.org 网站上的 Python 解释器解决了此问题,并将 azure 站点包复制到该安装位置。

因此,请尝试从官方网站切换到python解释器以及此GitHub issue中给出的故障排除步骤。 .

关于python - Azure 语音到文本 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72005067/

相关文章:

audio - 如何将mp3\wav语音拆分为单独的音素?

python - 无法将 azure.cognitiveservices.speech 作为 python 中的peechsdk 导入(Azure 函数)错误(段错误(核心转储))

Python-根据函数参数构造变量名

python - 检测导入模块中的 ImportError

python - Python/Mechanize 中的 Http 错误 405/500(使用 mechanize 自动登录一个网站)

debugging - Azure远程调试: Failed to enable remote debuggingException from HRESULT: 0x89710023

azure - 如何使用 Terraform 创建服务主体并在提供程序中使用该主体?

c# - NLOG 和 Azure 表存储

android - 文本转语音初始化延迟

python - 写入在第二个函数中打开的文件 (Python)