• We just launched and are currently in beta. Join us as we build and grow the community.

How to Create a Text-To-Speech Application in VB.NET

SwiFt

Rank Recovery Specialist
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
107
Likes
125
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
This is my another tutorial in VB.NET that converts an inputted text into a speech or voice. We will just only call the Speech API namespace for this program and with the use of Spvoice object. The SpVoice object brings the text-to-speech (TTS) engine capabilities to applications using SAPI automation. An application can create numerous SpVoice objects, each independent of and capable of interacting with the others. A SpVoice object usually referred to simply as a voice, is created with default property settings so that it is ready to speak immediately.

So, now let's start this tutorial!
  1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
  2. Next, add one TextBox named TextBox1 for inputting a text to become a speech, and add one button named Button1 to convert the inputted text into speech. Design your layout like this one below:

    ttsdesign.png

  3. Put this code to your Button1_Click. This will trigger to speak your inputted text.
    1. Private

      Sub

      Button1_Click(

      ByVal

      sender As

      System.

      Object

      , ByVal

      e As

      System.

      EventArgs

      )

      Handles

      Button1.

      Click
    2. Dim

      tts =

      CreateObject

      (

      "SAPI.spvoice"

      )
    3. tts.

      speak

      (

      TextBox1.

      Text

      )
    4. End

      Sub

Explanation:

We have initialized a tts variable to create an object of SAPI.spvoice. A SAPI.spvoice is created with its audio output set to the system default audio output. It also determines what other outputs are available to the voice, and use another property to set its audio output to one of them.

The Speak method here places a text stream in the TTS engine's input queue of our inputted text in TextBox1 and returns a stream number. It can be called synchronously or asynchronously. When called synchronously, the Speak method returns immediately, and the voice speaks as a background process.

Output:

Click the button to speak the inputted text.
ttsoutput.png


DEMO

You can also download the source code below and try it! :)

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.

Best Regards,
Engr. Lyndon R. Bermoy

IT Instructor/System Developer/Android Developer

Mobile: 09079373999

Telephone: 826-9296

E-mail:[email protected]

Visit and like my page on Facebook at: Bermz ISware Solutions

Subscribe at my YouTube Channel at: SerBermz


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,526

323,535

Top