skip to Main Content

I’ve been developing a TTS app using Azure Speech SDK and it was working OK until I found out that I get "System.Net.Http.HttpRequestException" for certain languages.

To be specific, those are the neural voices with [新規作成] (newly added) flag listed at
https://github.com/MicrosoftDocs/azure-docs.ja-jp/blob/master/articles/cognitive-services/Speech-Service/language-support.md.

I personally need to create TTS audio files now for km-KH-SreymomNeural and km-KH-PisethNeural and if anybody knows what I might be doing wrong, please kindly let me know. Thank you!

3

Answers


  1. For me i would consult this doc to see the supported languages and its always updated if there is other languages has been add:

    https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=stt-tts

    i thank you a lot for verifying with me if that helped you or not 😀

    Login or Signup to reply.
  2. Locale km-KH is supported by Azure Speech SDK. Could you try the latest version 1.23.0?

    Login or Signup to reply.
  3. In general, the System.Net.Http.HttpRequestException exception occurs when exceptions are thrown by the HttpClient and HttpMessageHandler classes.

    A base class for exceptions thrown by the HttpClient and HttpMessageHandler classes.

    However, I could able to make this work using below code which converts text to speech using the key and region of your cognitive services and also saves the audio files in .wav format following How to synthesize speech from text.

    Microsoft.CognitiveServices.Speech; using
    Microsoft.CognitiveServices.Speech.Audio;
    
    class Program {
        async static Task Main(string[] args)
        {
           string Key = "<KEY>";
           string Region = "<REGION>";
            var config = SpeechConfig.FromSubscription(Key, Region);
    
            config.SpeechSynthesisVoiceName = "km-KH-SreymomNeural";
            using var audioConfig = AudioConfig.FromWavFileOutput("audio.wav");
    
            Console.WriteLine("Enter the Sample Text to Speech string");
            using (var synth = new SpeechSynthesizer(config))
            {
                string textToSpeech = Console.ReadLine();
                await synth.SpeakTextAsync(textToSpeech);
                var synth1 = new SpeechSynthesizer(config, audioConfig);
                synth1.SpeakTextAsync(textToSpeech);
            }
    
            Console.WriteLine("Done Converting!");
            
            Console.ReadKey();
        } } 
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search