Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.speech says "area code" on numbers

I am using simple C# code to let a program talk

        if (checkBox1.Checked == true) {
            SpeechSynthesizer speaker = new SpeechSynthesizer();
            speaker.Rate = 1;
            speaker.Volume = 100;
            speaker.Speak(stringout);

The problem is that string out contains sentences with numbers. And Microsoft Speech recognizes these as 'area codes'. So for example instead of saying

sample 90 123 40

I hear:

sample *area code* 90 123 40

How to stop this behaviour?

like image 220
user613326 Avatar asked Jul 11 '12 15:07

user613326


1 Answers

Try this:

speaker.SpeakSsml("sample <say-as interpret-as=\"string\" format=\”digit string\” detail=\”string\”>90 123 40<say-as>");

If that works, do a RegEx replace on your string in to wrap numbers in that string.

like image 198
hcarver Avatar answered Nov 13 '22 17:11

hcarver