如何在Microsoft BOT中测试语音输入?

时间:2016-07-27 08:37:28

标签: speech-recognition speech-to-text botframework

我在其中一个BOT(MS BOT framework-.net)中集成了语音输入api(Bing Speech API),我正在研究,但不知道如何测试它是否正常工作。 MS Bot仿真器是否便于使用麦克风进行测试?或者我应该使用Skype等任何渠道进行测试吗? Plz协助。

由于

2 个答案:

答案 0 :(得分:2)

我使用https://docs.botframework.com/en-us/skype/calling/#calling-conversation-object-model中定义的记录操作创建了一个Skype机器人来记录用户的音频,然后在完成录制后使用Bing语音识别API执行语音到文本。音效档。

      private async Task OnRecordCompleted(RecordOutcomeEvent recordOutcomeEvent)
    {      
      string s = string.Empty;
                 string path = string.Empty;
                  if (recordOutcomeEvent.RecordOutcome.Outcome = Outcome.Success)
                 {
                      var record = await recordOutcomeEvent.RecordedContent;
            path =               HttpContext.Current.Server.MapPath($"~/{recordOutcomeEvent.RecordOutcome.Id}.wav");
            using (var writer = new FileStream(path, FileMode.Create))
            {
                await record.CopyToAsync(writer);
            }
            Attachment att = new Attachment()
            {
                ContentUrl = "file:///" + path,
                ContentType = "audio/wav",

            };
            s = DoSpeechReco(att);

答案 1 :(得分:0)

许多频道允许您将音频文件发送到机器人。如果您在Facebook Messenger上启用机器人,只需按麦克风图标即可录制音频

enter image description here

录制音频的播放器将显示在用户的流中,音频文件将作为附件传回您的机器人:

enter image description here

相关问题