6

I have integrated Speech input api (Bing Speech API) in one of the BOTs (MS BOT framework-.net) I am working on, but not sure how to test if it is working or not. Does MS Bot emulator facilitate testing it with mic? or should I use any of the channels like skype to test it? Plz assist.

Thanks

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Ashish
  • 61
  • 3

2 Answers2

2

I have created a Skype bot using the record action as defined in https://docs.botframework.com/en-us/skype/calling/#calling-conversation-object-model to record audio from the user, and then perform speech-to-text with the Bing speech recognition API after the recording has been completed using the soundfile.

      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);
Jon Clements
  • 138,671
  • 33
  • 247
  • 280
  • Can you please look at this question and please guide, this seems similar to my problem ... https://stackoverflow.com/questions/54704197/create-a-bot-that-can-record-voice-using-c-sharp – Sana Ahmed Feb 15 '19 at 12:58
0

A number of the channels allow you to send audio files to your bot. If you enable your bot on Facebook Messenger, simply press the microphone icon to record audio

enter image description here

A player for the recorded audio will appear in the user's stream and an audio file be passed back to your bot as an attachment:

enter image description here

Lars
  • 9,976
  • 4
  • 34
  • 40