user11892736
user11892736

Reputation: 51

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

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!

Upvotes: 0

Views: 525

Answers (3)

SwethaKandikonda
SwethaKandikonda

Reputation: 8244

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

Upvotes: 1

Yulin Li
Yulin Li

Reputation: 426

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

Upvotes: 1

PsyKali
PsyKali

Reputation: 69

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 :D

Upvotes: 1

Related Questions