Azure Text to Speech API: New languages not available, yet?

Viewed 60

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

Locale km-KH is supported by Azure Speech SDK. Could you try the latest version 1.23.0?

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

Related