public virtual Stream TextToSpeech(string text, BingSpeechLocaleOptions locale, string voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat)
        {
            var response = Task.Run(async() => await RepositoryClient.GetAudioStreamAsync(
                                        $"{ApiKeys.BingSpeechEndpoint}synthesize",
                                        text,
                                        locale,
                                        voiceName,
                                        voiceType,
                                        outputFormat,
                                        RepositoryClient.SendBingSpeechTokenRequest(ApiKeys.BingSpeech))).Result;

            return(response);
        }
Exemple #2
0
        public virtual async Task <Stream> TextToSpeechAsync(string text, SpeechLocaleOptions locale, VoiceName voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat)
        {
            var response = await RepositoryClient.GetAudioStreamAsync(
                ApiKeys.SpeechEndpoint,
                text,
                locale,
                voiceName,
                voiceType,
                outputFormat,
                GetSpeechToken());

            return(response);
        }