下面是代码
call_name1="test.wav"
blob_client1=blob_service_client.get_blob_client("bucket/audio",call_name1)
print(blob_client1)
streamdownloader=blob_client1.download_blob()
stream = BytesIO()
streamfinal=streamdownloader.download_to_stream(stream)
print(streamfinal)
speech_key, service_region = "12345", "eastus"
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
audio_input = speechsdk.audio.AudioConfig(filename=streamfinal)
错误
TypeError Traceback (most recent call last)
<ipython-input-6-a402ae91606a> in <module>
44 speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
45
---> 46 audio_input = speechsdk.audio.AudioConfig(filename=streamfinal)
C:\ProgramData\Anaconda3\lib\site-packages\azure\cognitiveservices\speech\audio.py in __init__(self, use_default_microphone, filename, stream, device_name)
213
214 if filename is not None:
--> 215 self._impl = impl.AudioConfig._from_wav_file_input(filename)
216 return
217 if stream is not None:
TypeError: in method 'AudioConfig__from_wav_file_input', argument 1 of type 'std::string const &'
请帮助我们从存储容器中读取音频文件作为Azure语音api的输入。谢谢
正如ewong在评论中所说,您需要获取
stream
而不是字符串download_to_stream
用于将此blob的内容下载到流中。但不是{我找不到将流转换为AudioInputStream的解决方法。因此,这似乎是将音频文件从存储Blob下载到本地,然后通过AudioConfig上传的唯一方法
相关问题 更多 >
编程相关推荐