How to test speech input in microsoft BOT?

I have a built-in speech input api (Bing Speech API) in one of the BOT (MS BOT framework-.net) that I am working on, but not sure how to check if it works or not. Does the MS Bot emulator make it easier to test with a microphone? or should I use any of the channels like skype to check it out? Help Plz.

thank

+4
source share
2 answers

I created a Skype bot program using the recording action defined in https://docs.botframework.com/en-us/skype/calling/#calling-conversation-object-model to record sound from the user, and then make a -to speech -text with the Bing Speech Recognition API after recording using a sound file.

      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
source

Several channels allow you to send audio files to your bot. If you enable your bot in Facebook Messenger, just click the microphone icon to record audio

enter image description here

The player for the recorded sound will appear in the user stream, and the audio file will be transferred to your bot as an attachment:

enter image description here

0
source

Source: https://habr.com/ru/post/1649257/


All Articles