通过python库调用函数AudioConfig.FromWavFileInput时出现问题

通过python库调用函数AudioConfig.FromWavFileInput时出现问题,python,azure,speech-recognition,azure-machine-learning-studio,Python,Azure,Speech Recognition,Azure Machine Learning Studio,我正在尝试使用Azure认知语音服务处理.wav文件。我正在使用下面的脚本。当我试图通过调用设置wav文件时,我得到一个异常,即“type object'AudioConfig'没有'FromWavFileInput'属性”。文档中说该函数存在,至少在.net库中存在。是否存在针对的FromWaveFileInput?如何使用python处理音频文件 import azure.cognitiveservices.speech as speechsdk speechKey = 'xxxxxxxx

我正在尝试使用Azure认知语音服务处理.wav文件。我正在使用下面的脚本。当我试图通过调用设置wav文件时,我得到一个异常,即“type object'AudioConfig'没有'FromWavFileInput'属性”。文档中说该函数存在,至少在.net库中存在。是否存在针对的FromWaveFileInput?如何使用python处理音频文件

import azure.cognitiveservices.speech as speechsdk

speechKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
service_region = 'eastus2'

#### # Creates an instance of a speech config with specified subscription key and service region.
#### # Replace with your own subscription key and service region (e.g., "westus").
speech_config = speechsdk.SpeechConfig(subscription=speechKey, region=service_region)

audioInput = speechsdk.AudioConfig.FromWavFileInput('RainSpain.wav')

#### # Creates a recognizer with the given settings
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_input=audioInput)

确实如你所说。我在GitHub repo上搜索了WavFileInput中的关键字
AudioConfig
&
,除了Java、C#和

根据我的经验,有两种解决方法

将C++代码打包为A,或与C++/java代码通信。
  • 直接与一起使用,对于Python和Azure语音服务来说非常简单

  • 这很有魅力

    audio\u filename=“something.wav”
    音频输入=speechsdk.audio.AudioConfig(文件名=音频文件名)