Speech Synthesis
I am writing an "AI" type app. for my visually challenged grandchild. Basically where it "talks to her" much like Eliza back in the sixties. I can not get a handle on how to output to the speech processor. Now please understand I am not wanting to do anything "grand" but simply say something as an output line. I have a basic program that runs on a Mac that simply has a (say "string") command. I have bought all the MS books for C# (only real documentation available) and am learning, as I go, is there anything this basic on C#. I can't find any good examples of comple code and as we know one simple bit of punctuation missing or incorrect causes major confusion?
I would really like a working example... As I have visual studio I can write in one of the other languages but they don't have the facilities that the c# editor has?
Katt
Answers
- I'll give you the 5 minute drill to get started. If you're running Windows XP, you should already have the speech API installed. If not, you can download it from here. The current version is 5.1, XP comes with 5.0. Start a new C# project, choose Project + Add Reference, COM tab, select "Microsoft Speech Object Library". That automatically creates a wrapper for the ActiveX interface.
To make it talk:
private void button1_Click(object sender, EventArgs e) {
SpeechLib.SpVoice spkr = new SpeechLib.SpVoice();
spkr.Speak("Nobugz was here", SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);
}
There's a million options, selecting voices and choosing where the spoken text is coming from. Hopefully, you can find some that would please a child. The full documentation for the speech API is available here.
All Replies
- I'll give you the 5 minute drill to get started. If you're running Windows XP, you should already have the speech API installed. If not, you can download it from here. The current version is 5.1, XP comes with 5.0. Start a new C# project, choose Project + Add Reference, COM tab, select "Microsoft Speech Object Library". That automatically creates a wrapper for the ActiveX interface.
To make it talk:
private void button1_Click(object sender, EventArgs e) {
SpeechLib.SpVoice spkr = new SpeechLib.SpVoice();
spkr.Speak("Nobugz was here", SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);
}
There's a million options, selecting voices and choosing where the spoken text is coming from. Hopefully, you can find some that would please a child. The full documentation for the speech API is available here. A few additional questions. Please, what about headers, and will this work in console mode. Sorry but I am very new to these things and predate line basic (try assembler) .. Thanks
P.S. I am having a difficulty finding the "Microsoft Speech Object Lib.... I downloaded sdk 5.1 but mabe I did something wrong.???? I am running xp and visual 2005.Katt
- You don't need headers, ActiveX components are "self-declaring". It should work fine in console mode. Be sure to look for "Microsoft Speech Object Library" under the "COM" tab, not the ".NET" tab...
Bless you for the help.... I think I may have it... will let you know... Why does this have to be so hard?? instead of a simple command... objects are hard to get down.
K.
nobugz.... I have a problem with the code after the "Nobugz was here", I get either an compiler error relating to "no overload allowed" or a context issue with SpeechVoice..... SpeakFlags.. I also note that the inteli.. text doesn't find the words as I start this.section.. I know I am a dummy and am probably doing something wrong but can you look over the sample code you sent... all seems to be ok up to this line..... I did find all the other stuff you sent me to and have that part down. I think.
sorry to be a bother..
K
- Sorry, I just now got the alert for your message. Do you still have a problem?
Thanks noBugz
Iam completeley new to this, i saw this thread and tried using yur code, it worked perfeclty. as u told there are so many options available. this looks cool.
WOWOWEEE !!!
This is the BEST and make that the COOLEST thing that I've ever read..Thanks Nobugz!!!


