Programming is basically makeing the computer bow at your every wim. You can make your computer do everything, EVEN TALK! Making your computer speak isnt that hard and you can have it talkin in less than 10 min.
Download this now!!!
If you dont your never gonna be able to compile this code. www.microsoft.com/speech
Finally it begins
You can make this happen in nearly any computer language. I just so happen to know C++, so thats what I use.
To begin open Microsoft Visual C++.
Start a new project, for this tutorial I am making a windows 32 Application. Make a name for it that will make sence for later use (I named mine "tutorialtts")
Choose the radio button that says "a simple windows 32 application" (the middle one)
Now that youve got you environment set up, we can begin coding.
The first thing you have to do is open up StdAfx.h there will be a line that says
//TODO ADD ADITIONAL HEADERS HERE
add the following code on the line that is directly beneath that line
//Dont change anything!!!
#include < atlbase.h>
extern CComModule _Module;/
#include < atlcom.h>
now we need to rely on the compiler to do a job for us.
Under go the the menu "project > Settings". Click on the C++ tag near the top of the dialog box
Choose "Preproccesser" from the drop-down form.
and in the "additional include directories" box add this
C:\Program Files\Microsoft Speech SDK 5.1\Include.
Next go one tab over to the "Link" tab, in the category box choose "Input"
in the first box ("Object/library modules") add sapi.lib.
In the additional library path add
"C:\Program Files\Microsoft Speech SDK 5.1\Lib\i386"
Choose the OK button
I lied, this is the actual coding part
Open the file projectname.cpp and add this code
This code initializes COM and sets up what the program will say and makes it says it, thats all.
Thats all the code you need to add to the entire project, nothing more, maybe less(depends on what you are going for)
int main(int argc, char* argv)
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance
(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, <(void **)&pVoice);
if( SUCCEEDED( hr ) )
hr = pVoice->Speak(L"Hey, I can say what ever you want.", 0, NULL);
// Change pitch
hr = pVoice->Speak(L"My voice can even drop pitches.", SPF_IS_XML, NULL );
pVoice = NULL;
If you need the files I made go to my website.
This tutorial is also included in the files you need to compile these files (install them all the way before you send any complaints)