Microsoft's SAPI (speech Application Programming Interface) provides powerful Text to Speech interfaces and supports automation. In this way Program To introduce the COM component:
Add a reference to speechlib and find SAPI. dll in the system disk's Program Files \ common files \ microsoft shared \ speech directory.
In Code The spvoiceclass class speak method can be called in a simple sentence: Ispeechvoice v = New Spvoiceclass ();
V. Speak (txtspeak, speechvoicespeakflags. svsfdefault );
You can also use spfilestream to create an audio stream. For example, the following program can "read" the text to the wav file: // Declare the spvoice object.
Ispeechvoice v = New Spvoiceclass ();
// Create a wave stream
Spfilestream s = New Spfilestream ();
// Create a new. Wav file for writing.
S. Open ( "Out . Wav " , Speechstreamfilemode. ssfmcreateforwrite, False );
// Set the. Wav file stream as the output for the voice object
V. audiooutputstream = S;
// Call the Speak method now will send the output to the. Wav file.
V. Speak (txtspeak, speechvoicespeakflags. svsfdefault );
// Close the file
S. Close ();
This is just a few simple applications. Windows (my English version win2003) comes with SAPI does not support Chinese, Ms said version 5.1 SAPI can support Chinese, Japanese, and English languages, can be downloaded free of charge on the MS website. Continuing study ......