コード例 #1
0
        public virtual SpeechToTextResponse SpeechToText(Stream audioStream, ScenarioOptions scenario, BingSpeechLocaleOptions locale, SpeechOsOptions os, Guid fromDeviceId, int maxnbest = 1, int profanitycheck = 1)
        {
            string url   = GetSpeechToTextUrl(scenario, locale, os, fromDeviceId, maxnbest, profanitycheck);
            string token = RepositoryClient.SendBingSpeechTokenRequest(ApiKeys.BingSpeech);

            byte[] data = RepositoryClient.GetByteArray(audioStream);

            var response = RepositoryClient.Send(ApiKeys.BingSpeech, url, data, contentType, "POST", token, true, "speech.platform.bing.com");

            return(JsonConvert.DeserializeObject <SpeechToTextResponse>(response));
        }