Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. text; using system. windows. forms; using ttsapilib; namespace demo_vs2005_csharp {public partial class form1: FORM {public uint smspf_default = 0; // The default public uint smspf_sync = 1 <0; // public uint smspf_purgebeforespeak = 1 <1; Public uint smspf_is_filename = 1 <2; Public uint smspf_persist_xml = 1 <3; public uint smspf_speak_punc = 1 <4; // public uint smspf_nlp_speak_number = 1 <5; // number public uint smspf_voice_chinesefemale = 1 <6; // Chinese female public uint smspf_voice_englishmale = 1 <7; // english male public uint smspf_enablechange_rate = 1 <8; // The language speed can be changed. It can be changed by default. This option is not required. ushort ivolume; int irate; ttsapilib. smvoicece sp = new ttsapilib. smvoicece (); // you must first add the reference ttsapilib. DLL // ensure that the voice library has been installed. For more information, see the help documentation. public form1 () {try {initializecomponent (); SP. setrate (0); // sets the reading speed sp. setvolume (100); // set the volume of reading aloud // set the window handle of the notification function // parameter 1, indicating that the highlighted text box is displayed. If it is set to null or 0, the highlighted display function is invalid // The Window handle of parameter 2, indicating that the reading starts. The reading ends are returned to the text box sp. setpolicyeditwindow (this. textbox1.handle. toint32 (), this. textbox3.handle. toint32 ();} catch (exception ex) {}} private void button#click (Object sender, eventargs E) {try {// Chinese female voice recognition function // The first parameter indicates the input text // The second parameter indicates the language reading library and performance parameter settings, and smspf_voice_chinesalefeme indicates the Chinese female voice recognition library, // you can also choose whether to read punctuation. For details, refer to the help document // The third parameter dwreadstart 0, which indicates reading from the beginning. Otherwise, read from the corresponding position // fourth, the fifth parameter is currently retained without sp. speak ("hello", smspf_voice_chinesefemale, 0, null, null);} catch (exception ex) {}} private void button4_click (Object sender, eventargs E) {// stop reading. stop (); // stop function} private void button3_click (Object sender, eventargs E) {// english male reading function // The first parameter indicates the input text // The second parameter indicates the language reading library and performance parameter settings, and smspf_voice_englishmale indicates the English male language reading library, // you can also choose whether to read punctuation. For details, refer to the help document // The third parameter dwreadstart 0, which indicates reading from the beginning. Otherwise, read from the corresponding position // fourth, the fifth parameter is currently retained without sp. speak ("dsdfaf", smspf_voice_englishmale, 0, null, null);} private void button2_click (Object sender, eventargs e) {// pause/continue reading sp. pause (); // pause the function // sp. resume (); // continue function} private void trackbar1_valuechanged (Object sender, eventargs e) {// set the volume. // set the volume in the range of 0-100 sp. getvolume (Out ivolume); // get the read volume ivolume = 50; // set the volume. SP. setvolume (ivolume); // sets the volume of reading aloud} private void trackbar2_valuechanged (Object sender, eventargs e) {// sets the speed of speech in the range of-10-9 sp. getrate (Out irate); // get read Speed irate = 9; // set the speed. SP. setrate (irate); // set the reading speed} private void button5_click (Object sender, eventargs E) {// function for reading the wave file // The first parameter indicates the input text // The second parameter indicates the Reading Language Library and performance parameter settings, and smspf_voice_chinesefemale indicates the Chinese female language library, // you can also choose whether to read punctuation. For details, refer to the help document // The third parameter indicates the wave file name // The fourth parameter. SP is not used for the fifth parameter currently. speaktovoicefile (this. textbox1.text, smspf_voice_englishmale, this. textbox2.text, null, null);} private void textbox3_textchanged (Object sender, eventargs e) {// return the "tts_sdk_read_start" message, indicating that the reading starts, you can perform corresponding processing as needed // If (string. compare (this. textbox3.text, "tts_sdk_read_start") = 0) // MessageBox. showCode "," Add the user code at the beginning of reading "); // return the" tts_sdk_read_end "message, indicating that the reading is complete and can be processed as needed. // If (string. compare (this. textbox3.text, "tts_sdk_read_end") = 0) // MessageBox. show ("End of speech reading, here you can add the user code at the end of reading", "add the user code at the end of reading ");}}}
:
Download source code: Click me
Note:
In the wince system, voice prompts are not free to use third-party files. You need to register something. To put it bluntly, you have to pay for the API.
I have been searching online for a long time and have not found any information about the cracked version or free wince application voice prompts. C # I have not found any information, and I am not good at others.
However, although it is not free, voice prompts can be basically implemented,
-------------------------------------
The voice prompt process is as follows:
The preceding System xx + the voice prompt content we want + The following System xx
Note: the front and back of the prompt speech are not what we all want. The system prompts registration or something. I opened the registration official website, which is about equivalent to RMB. Nearly 1 W Nima is too expensive.
--------------------------------------------
I will consider how to get rid of the tangle behind it.
-------------