Azure TTS failing when using SSML

AlexAngelliux 0 Reputation points
2023-05-09T13:41:42.03+00:00

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='http://www.w3.org/2001/10/synthesis' " +
    $"xmlns:mstts='https://www.w3.org/2001/mstts' xml:lang='en-US'>" +
    $"<voice name='en-US-Michael'>" +
    $"<mstts:express-as style='neutral'>{messageText}</mstts:express-as>" +
    $"</voice>" +
    $"</speak>";

// 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,555 questions
{count} votes