SSML for phone numbers with spoken dash

83 Views Asked by At

For an accessibility application I am using

using System.Speech.Synthesis;
class Element{
SpeechSynthesizer speaker = new SpeechSynthesizer();

  private void speakPhone(string content){
     string speak_string = "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" "
        + "xmlns:mstts=\"https://www.w3.org/2001/mstts\" xml:lang=\"de-DE \">"
        + content + "</speak>";
     speaker.SpeakSsml(speak_string);
  }
}

Calling this with

Element element = new(Form1);
element.speakPhone("0123 456-789");

That way, the dash is just omitted in speaking.

But I want to acheive that the dash is spoken and each digit should be spoken instead of doing "seven hundred eighty...".

I replaced "-" with "Strich" but then it reads like "four-hundred-fifty six dash seven-hundred-..." (in German, of course)

Is there any elegant way with some <say-as> or other SSML tags?

1

There are 1 best solutions below

1
Peter  Adriaenssens On BEST ANSWER

This is a working script with the telephone tag. You can also use the ordinal tag if you want to say it number by number

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="string">
  <voice  name="en-AU-Catherine">
My phone number is <say-as interpret-as="telephone">
97 324 12 45
</say-as>
</voice>
</speak>

<say-as interpret-as='ordinal'>
034234545
</say-as>