Reputation: 879
Sometimes I have a number like #12543 and I want the synthesizer to say "Number one-two-five-four-three".
Other times I would like the synthesizer to say "Number twelve-thousand-five-hundred-fourty-three".
Does anybody here know what mechanism in System.Speech regulates the pronunciation of these numbers?
Upvotes: 0
Views: 416
Reputation: 54532
Look at the SayAs
Enumeration and the AppendTextWithHint
Method, this example is based on the Microsoft documentation.
using System;
using System.Speech.Synthesis;
namespace ConsoleApplication66
{
class Program
{
static void Main(string[] args)
{
SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SetOutputToDefaultAudioDevice();
PromptBuilder talk = new PromptBuilder();
talk.AppendText("#12543");
talk.AppendTextWithHint("#12543", SayAs.SpellOut);
talk.AppendTextWithHint("#12543", SayAs.NumberOrdinal);
talk.AppendTextWithHint("#12543", SayAs.NumberCardinal);
synth.Speak(talk);
}
}
}
Upvotes: 1