Zero Base-10 minutes to teach you how to make a voice function,-10 to teach you how to make a voice

Source: Internet
Author: User

Zero Base-10 minutes to teach you how to make a voice function,-10 to teach you how to make a voice

Before the official start of this blog, let's make a simple and fun little speech with me.

Create a text document and enter such a sentence in the document.CreateObject ("SAPI. SpVoice"). Speak "I Love You"And save the file with the suffix. VBS.

Double-click your text file ~~~~~~~


Isn't that good? Don't worry. There's more fun in the future.

Next, I will write a small DMEO, which can be produced after 5 minutes.

First, download a Microsoft TTS5.1 Speech Engine (Chinese). msi installation package. I have prepared it for you.

This article is a simple introduction, but it is the key to speech.

The simple logic is to find a person, find a sentence, define the way of pronunciation, and then implement this function.


It is not very important to use any language. I used C # as an example to draw a simple interface.


Then I wrote some simple code.

<Span style = "font-family: KaiTi_GB2312; font-size: 18px;"> using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. windows. forms; using System. media; using SpeechLib; namespace TTSSpeakDemo {# region voice read text Demo-2015-8-7-MDM /// <summary> // speech read text Demo-2015-8-7-MDM /// </summary> public partial class Spe AkDemo: Form {public SpeakDemo () {InitializeComponent (); // automatically generated, do not move} // <summary> // pronunciation object // </summary> public SpVoice voice = new SpVoice (); // This class supports speech synthesis (TTS). Call the TTS engine through the SpVoice object to implement the reading function. Public SpeechVoiceSpeakFlags spFlags = SpeechVoiceSpeakFlags. SVSFDefault; // private void btnSpeak_Click (object sender, EventArgs e) {string speakWord = this.txt Speak. text; voice. voice = voice. getVoices (string. empty, string. empty ). item (3); // Microsoft Mary, Microsoft Mike, Microsoft Sam, and Microsoft Simplified Chinese. The first three can only read English, the last can read Chinese, or the English voice. Speak (speakWord, spFlags) ;}# endregion }</span>


Such a simple program will come out. Run F5 to see the effect.


This blog is a simple entry-level article, which is still a bit far from being added to the project. In the future, we will continue to introduce this blog, how to flexibly Add the software to your project as needed ~ Coming soon ~





Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.