Saturday, 11 February 2017

How to make simple text to voice converter in batch ?

No doubt if someone want to develop a software for windows operating system
then he has to aware with batch and command line. Batch is a very good  scripting language if you want to start development because it has codes that are not only very small but also it increases your confidence to being a developer.

Here is a small example to show you how to make a simple text to voice converter using batch.

 I also used  visual basic with batch in this program . Don't worry about it you may find a lots of posts about visual basic on Internet.




@echo off


title Text to Speech Conversion


echo Enter your text


set /p text=


echo set speech = Wscript.CreateObject("SAPI.spVoice") >> "speechfile.vbs"


echo speech.speak "%text%" >> "speechfile.vbs"


start speechfile.vbs


pause


del speechfile.vbs





 
Explanation:

 The first line @echo off is used to hide your code on console window. In the next line we gave a title to our program. In third line we are requesting to user to enter his text.In the next two lines we are doing some file handling (you can find file handling form batch on the Internet to understand whats happening here) to write few codes of visual basic on a file named speechfile.vbs( .vbs files can directly execute in windows). In the next line we are executing our file i.e. speechfile.vbs. In the last line we are deleting the file so that we can further write data on it from beginning.

Here is a screenshot of my program 



I hope you enjoyed. Thanks :-)






No comments:

Post a Comment