Azure语音SDK使用python从流中语音转换为文本 [英] Azure Speech SDK Speech to text from stream using python

查看:105
本文介绍了Azure语音SDK使用python从流中语音转换为文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将UI的流作为流发送到python API.我需要python Azure语音逻辑将语音转换为文本.我不确定如何使用pull/pusha音频输入流将语音转换为文本

I am trying to send the stream from UI to python API as stream. I need python Azure Speech logic to convert the speech to text. I am not sure about how to use pull/pusha audio input stream for speech to text

推荐答案

就我而言,我从其他来源接收到音频流.与我的应用程序建立连接后(在收到第一个程序包时),将启动PushAudioInputStream.此流将接收到的每个程序包的数据推送到SDK.因此在这种情况下使用具有推流的语音识别.请参见下面的代码段.这对我的情况有用.

In my case I receive an audio stream from some other source. When the connection with my application is made (upon reception of the first package), a PushAudioInputStream is started. This stream pushes the data to SDK for each package that is received. The speech recognition with push stream is thus used in this case. See snippet of code below. This has worked for my case.

if newConnection:
    stream = speechsdk.audio.PushAudioInputStream()
    speech_recognition_with_push_stream(stream)

stream_data = base64.b64decode(data)
stream.write(stream_data)

这篇关于Azure语音SDK使用python从流中语音转换为文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆