Let the computer speak English in our program

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.