1

I am trying to use Bing's speech API within the Bot Framework (I am familiarizing myself with both of these technologies). Specifically, I am trying to use the DataClientWithIntent that it supports. I was able to look at this example in GitHub, but unfortunately this is seems to be using DataClient only and I am not able to identify where this is specified. The API is being called in the following manner:

    using (var client = new HttpClient())
    {
        var token = Authentication.Instance.GetAccessToken();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token.access_token);

        using (var binaryContent = new ByteArrayContent(StreamToBytes(audiostream)))
        {
            binaryContent.Headers.TryAddWithoutValidation("content-type", "audio/wav; codec=\"audio/pcm\"; samplerate=16000");

            var response = await client.PostAsync(requestUri, binaryContent);
            var responseString = await response.Content.ReadAsStringAsync();
            dynamic data = JsonConvert.DeserializeObject(responseString);
            return data.header.name;
        }

As you can see a stream is passed in, but unfortunately this only writes back what the user wrote.

I have already developed a test bot that uses a Luis application for what I want, but I want to add the ability for the user to either talk to it or type and achieve the same results. I did find this other example, but this is implementing it directly through the Skype framework, which is something I am not interested in at the moment.

Any ideas, documentation, or clarification would be appreciated.

havan
  • 164
  • 2
  • 11
  • If I summarize, once you call Bing API you got a text version of the stream you sent, right? So you just have to send this text to your LUIS API and it will be the same as if your user was inputting text directly – Nicolas R Jun 21 '17 at 13:05
  • 1
    It is possible to do this, but according to Microsoft's documentation, there is a way to do a single call to the Speech-to-Text API, and this in turn will call Luis. Resulting in a single web call instead of 2 (performance). (Edit) I found [this example] (https://github.com/Microsoft/ProjectOxford-ClientSDK/blob/master/Speech/SpeechToText/Windows/samples/SpeechRecognitionServiceExample/MainWindow.xaml.cs) that uses an SDK to do the call from c#. – havan Jun 22 '17 at 09:15

0 Answers0