我正在尝试在我的自定义语音应用程序中使用 Direct Line Speech (DLS)。语音应用程序可以访问实时音频流,我希望将其直接(pcm 编码)到 Direct Line Speech,从而允许实时来回通信。
从 DLS 客户端示例代码 ( https://github.com/Azure-Samples/Cognitive-Services-Direct-Line-Speech-Client ) 中,我看到 Microsoft.CognitiveServices.Speech.Dialog.DialogServiceConnector 命名空间中的 ListenOneAsync() 方法,但看起来它正在从本地麦克风捕获媒体。
但是看这里的回复(Is new ms botbuilder directline speech good fit for call center scenario?),看来我可以直接将音频流发送到DLS。我似乎找不到与此相关的任何文档。有人可以阐明如何实现这一目标吗?
最佳答案
我相信你的答案就在 Microsoft.CognitiveServices.Speech.Audio.AudioConfig
类(class)。看看this line在 Direct Line Speech 客户端中:
this.connector = new DialogServiceConnector(config, AudioConfig.FromDefaultMicrophoneInput());
AudioConfig
除了 FromDefaultMicrophoneInput
之外还提供了许多选项。我怀疑您会想使用三个 FromStreamInput
之一过载。如果您这样做,ListenOnceAsync
将使用您的流而不是麦克风。
关于c# - 如何将实时音频流传递到 Direct Line Speech 端点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58212779/