社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

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

Brian GD • 5 年前 • 748 次点击  

我正在尝试使用Azure认知语音服务处理.wav文件。我正在使用下面的脚本。当我试图通过调用 AudioConfig.FromWavFileInput() . 文档说明函数至少存在于.NET库中。是否存在 cognitiveservices-speech python library ? 如何使用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)
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50525
 
748 次点击  
文章 [ 1 ]  |  最新文章 5 年前
Peter Pan
Reply   •   1 楼
Peter Pan    6 年前

确实如你所说。我搜索关键字 AudioConfig &安培; FromWavFileInput 关于GitHub回购 Azure-Samples/cognitive-services-speech-sdk ,除了Java、C#和 C++ .

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

  1. 将C++代码打包为 Python extension module ,或者与C++/Java代码通信。
  2. 直接使用 Speech service REST APIs 具有 requests ,对于Python和Azure语音服务来说很简单。