Reputation: 61
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
Upvotes: 6
Views: 1572
Reputation: 21
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);
Upvotes: 2
Reputation: 10573
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
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:
Upvotes: 0