Speech implementation
"Computer pronunciation" (English) a very good trigger point, through it can achieve electronic novel reading, English listening test, English word learning ...
The following speech has a simple encapsulation of the Mstts.
1. Install a good Mstts, you can hit the Vtxtauto.lib file in the Windows\speech
2. Convert Vtxtauto.tlb to a. dll format with the TlbImp tool with the. Net SDK:
TlbImp Vtxtauto.tlb/silent/namespace:mstts/out:mstts.dll
The Mstts.dll has become a class of the. NET Framework runtime.
3. Write a simple class that encapsulates the Vtxtauto: Speech.
========================speech.cs======================
Using System;
Using Mstts; Mstts name Space
Namespace bedlang{//define Namespaces
public class speech{
Private Vtxtauto Vtxtautoex;
Public Speech () {
Vtxtautoex = new Vtxtauto ();
Vtxtautoex.register ("", ""); Registering COM components
}
public void Speak (String text) {
Vtxtautoex.speak (text, 0); Pronunciation
}
}
}
========================speech.cs======================
4. Compile Bedlang.speech
Csc/target:library/out:bedlang.dll Speech.cs/r:mstts.dll
5. Pronunciation Realization
========================demo.cs======================
Using System;
Using System.Windows.Forms;
Using Bedlang; Reference namespace
public class Demo:form {
public static void Main () {
Application.Run (New demo ());
}
Public demo () {
Speech s = new Speech (); Create a Speech object
S.speak ("Bedlang"); Pronunciation
}
}
========================demo.cs======================
6. Compile Demo.cs
CSC Demo.cs/r:bedlang.dll
7. Run Demo.exe
Program pronunciation.