Program Demo: Click to download
Source File: Click to download
1. First install Kingsoft
Then, the vtxtauto. TLB file will be found in speech under the system directory [Win2000 is the WINNT directory ].
2,Import COM objects to. net
We can use tlbimp.exe, a powerful tool provided by. Net framework, to import the COM Object of sapi sdk to. net. Tlbimp.exe generates a controlled packaging class, which can be used by the management client. Number of reference packages for managing the actual COM object. When the packaging class is used as the collection garbage, the packaging class releases the COM object it wraps. Finished.
C: \ winnt \ speech> tlbimp vtxtauto. TLB/namespace: dotnetspeech_e/out: dotnetspeech_e.dll
3. Use C # To develop an English TTS application example
The following example shows how to use C # To develop an English speech application. The development environment is:
Win2k + SP4 +. NET Framework V1.1 + Microsoft Visual Studio. NET 2003
First, create a C # windows application project speechapp [En] and add the dotnetspeech_e Object Library in Solution Explorer on the right of the development environment. Right-click "Reference" and choose "add reference". In the displayed dialog box, find the generated dotnetspeech_e.dll.
Now we can start writing applications.Code. This example shows how to read the English text in a speaker.
Program Interface
///
/// Read aloud
///
//////Private void buttonsynthesis_click (Object sender, system. eventargs E)
{
Try
{
If (this. textbox1.text. Trim ()! = "")
{
Dotnetspeech_e.ivtxtauto ivta = new dotnetspeech_e.vtxtautoclass ();
Ivta. Register ("","");
Ivta. Speak (this. textbox1.text, 0 );
}
}
Catch (system. Exception EC)
{
MessageBox. Show (EC. tostring (), "speechapp", messageboxbuttons. OK, system. Windows. Forms. messageboxicon. Error );
}
}
4,Conclusion
The. NET environment makes this development more convenient and convenient. Hurry up and test your application. Let's go !!!
Source: http://www.lionsky.net/MyWebsite/article/list.aspx? Id = 439