Azure TTS failing when using SSML

AlexAngelliux 0 Reputation points

Hi everyone,

I'm developing a C# CLI to read chats from selected Twitch Chatters using Azure text-to-speech.

I've set up the string 'messageText' to contain the given chat, and string 'ssmlText' to add relevant SSML to messageText. This is done to change the voice the text-to-speech uses. I also want to be able to have chat use keywords like '(terrified)' or '(excited)' to change the voice's emotion accordingly.

However, SSML is not working- in any form- for me. The app itself works, as if I change the speech synthesizer to read just messageText it works fine.

Is it because I am a non-paid Azure user? Is there an error with my code?

Here is my code to convert messageText to SSML:

string ssmlText = $"<speak version='1.0' xmlns='' " +
    $"xmlns:mstts='' xml:lang='en-US'>" +
    $"<voice name='en-US-Michael'>" +
    $"<mstts:express-as style='neutral'>{messageText}</mstts:express-as>" +
    $"</voice>" +

// line that is supposed to read the SSML
var speechSynthesisResult = await speechSynthesizer.SpeakSsmlAsync(ssmlText);
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,484 questions
{count} votes