Thursday, April 28, 2011

Text to Speech Conversion Using VB Script for Windows

Friends, you must have already come across text to speech conversion* in many applications like Opera web browser, Firefox's text-to-voice addon, Adobe reader, etc. But what most of us do not know is that there most operating systems have an inbuilt support for speech synthesis and speech recognition. For example, modern Windows desktop systems use SAPI 4 and SAPI 5 components to support speech synthesis and speech recognition.

In this post, I have a small piece of code which makes use of inbuilt speech synthesis feature in Windows to convert text entered by you into speech.


Size: 0.268KB
If you want to make the above script for yourselves instead of downloading, follow these steps:
1. Open Notepad and copy the below code into it.
Dim msg, sapi

msg=InputBox("Enter your text for conversion")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak msg
2. Save the file as text2speech.vbs
         Note: Saving with extension .vbs is compulsory as shown in the following screenshot.

3. Double click on the saved script file and enter the text. You listen to the speech yourself.


 The above VB script works only in Windows Operating System. If you are a Linux user, you are quite lucky as there are plenty of softwares like CMU Sphinx, Festival, etc which can convert text to speech and also save the speech in audio format like MP3.

* Text-to-Speech refers to the ability of computers to read text aloud

1 comment:

  1. I think vb script also works under Linux with WINE. Have you tried?

    ReplyDelete