With the development of computer multimedia technology, it is nothing new to make computers sing and speak. But can we ask the computer to read text in our own software? The text-to-speech engine (TTS) developed by Microsoft makes it easy to implement this function. If you have installed Kingsoft 2000 (or Kingsoft. in the Windows folder, a speech folder named vtxtauto is generated. the TLB file contains related types of libraries and functions. We can call them in our program to make the computer speak. TTS is contained on the installation disk of Kingsoft Mac. The names are mstts.exe and spchapi.exe. To call TTS in VB, you must first reference vtxtauto. the "voicetext 1.0 Type Library" Type Library in The TLB file is used to execute "Project/reference" and click "Browse" to find the file/Windows/speech/vtxtauto. TLB, add it to the Application List, select it, and click "OK. Press the F2 key to open "Object Browser" to view the relevant parameters of the vtxtauto object.
Then type the following code and execute it. Then the computer can talk:
Option explicit
Private sub form_load ()
Call vtxtauto. vtxtauto. Register (space (1), space (1) 'Registration
Vtxtauto. vtxtauto. speed = 170 'sets the language speed (170 indicates the normal language speed, and the lower the value, the slower the language speed)
Dim strtxt
Strtxt = "I'm a Chinese. I love my motherland very much ."
On Error goto errorhand
Call vtxtauto. vtxtauto. Speak (strtxt, vtxtsp_veryhigh + vtxtst_reading)
Msgbox "OK! "
End
Errorhand:
'Error handling statement
End
End sub
Microsoft's text reading engine can only allow computers to read English. I believe that everyone, like me, is looking forward to the emergence of domestically developed and technically mature Chinese-speaking software.
Zhang Qing zhangking@263.net
Http://www.why100000.com
2003.1.24