How to pass real-time audio stream to the Direct Line Speech endpoint?

爷,独闯天下 提交于 2019-11-30 19:54:20

问题


I am trying to use Direct Line Speech (DLS) in my custom voice app. The Voice app has access to the real-time audio streams which I want to (pcm encoded) it directly to Direct Line Speech that allows a back and forth communication in real-time.

From the DLS Client sample code (https://github.com/Azure-Samples/Cognitive-Services-Direct-Line-Speech-Client), I see that the method ListenOneAsync() in Microsoft.CognitiveServices.Speech.Dialog.DialogServiceConnector namespace, but looks like it's capturing media from local microphone.

But looking at the reply here (Is new ms botbuilder directline speech good fit for call center scenario?), it seems I can send the audio stream to the DLS directly. I can't seem to find any documentation around this. Can someone shed some light on how to achieve this?


回答1:


I believe your answer lies in the Microsoft.CognitiveServices.Speech.Audio.AudioConfig class. Have a look at this line in the Direct Line Speech client:

this.connector = new DialogServiceConnector(config, AudioConfig.FromDefaultMicrophoneInput());

AudioConfig provides many options besides FromDefaultMicrophoneInput. I suspect you'll want to use one of the three FromStreamInput overloads. If you do that then ListenOnceAsync will use your stream instead of the microphone.



来源:https://stackoverflow.com/questions/58212779/how-to-pass-real-time-audio-stream-to-the-direct-line-speech-endpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!