Introduction: Make Your Own Text-To-Speech Program!!!

This will teach you how to code a file so that it says whatever you type!

Step 1: The Code

1: Make a new file in notepad
2: Paste the code
3: save as 'Talk.bat'




Code:
@echo off
@mode con cols=55 lines=10
title Talk
color A
:st
echo Type what you would like the program to say
set /p command=
cls
cd "%userprofile%\desk*"
if exist Talk_.vbs del Talk_.vbs
copy NUL Talk_.vbs
cls
ping localhost -n 2 > nul
echo strText = ("%command%")> "Talk_.vbs"
echo Set objvoice = CreateObject("SAPI.SpVoice")>> "Talk_.vbs"
echo ObjVoice.Speak strText>> "Talk_.vbs"
cls
echo Analyzing text input 
echo please wait
ping localhost -n 1 > nul
echo.
echo ²                        ² 0%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²Û                       ² 4%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛ                      ² 9%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛ                     ² 13%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛ                    ² 18%%
ping localhost -n 2 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛ                   ² 22%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛ                  ² 27%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛ                 ² 31%%
ping localhost -n 2 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛ                ² 36%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛ               ² 40%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛ              ² 45%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛ             ² 49%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛ            ² 54%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛ           ² 58%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ          ² 63%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ         ² 67%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ        ² 72%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ       ² 76%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ      ² 81%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ     ² 85%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ    ² 87%%
ping localhost -n 2 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ   ² 91%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ  ² 93%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ² 97%%
ping localhost -n 1 > nul
cls
echo Analyzing text input 
echo please wait
echo.
echo ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ² 100%%
ping localhost -n 5 > nul
cls
cd "%userprofile%\desk*"
start Talk_.vbs
ping localhost -n 3 > nul
del Talk_.vbs
cd..
cls
goto st

Comments

author
AadityaP (author)2014-11-27

Awesome! I made it but I was wondering if I could customize. I did customize under the startup message and text color, but I was wondering if I could change the

Û s into something else. I tried entering letters and unicode but it all came up wierd.

author
searx (author)AadityaP2014-11-28

You can condense the code to the following if you don't want to have to deal with the letter changes:

@echo off
@mode con cols=55 lines=10
title Talk
color A
:st
echo Type what you would like the program to say
set /p command=
cls
cd "%userprofile%\desk*"
if exist Talk_.vbs del Talk_.vbs
copy NUL Talk_.vbs
cls
ping localhost -n 2 > nul
echo strText = ("%command%")> "Talk_.vbs"
echo Set objvoice = CreateObject("SAPI.SpVoice")>> "Talk_.vbs"
echo ObjVoice.Speak strText>> "Talk_.vbs"
cls

cd "%userprofile%\desk*"
start Talk_.vbs
ping localhost -n 3 > nul
del Talk_.vbs
cd..
cls
goto st

author
VasundhraG (author)2014-09-03

Hey, thanks for sharing this code. But I keep getting the error that "the file talk_.vbs was not found". Any help?

author
searx (author)VasundhraG2014-09-06

Make sure that the talk_.vbs file is being created and searched for in the same directory. If you are using a computer that doesn't recognize either the %userprofile% command or the desk* command you can manually change the code from cd "%userprofile%\desk*" to the directory of where you want the file to be stored. For example it could be changed to cd "C:\Users\YourUsername\MyDocuments".

Let me know if that helps at all.

Good Luck!

author
unna628 (author)2017-03-15

Hi I am looking for someone to customize the open source Mary TTS software for me. Please can you advise if you do similar type of work or are aware of anyone that does? Thank you.

author
searx (author)unna6282017-03-21

What kind of customization are you looking for?

author
AnneZag made it! (author)2016-12-31

It works! Thanks a lot. I made a little modification BTW.

To save the audio output (in .wav), replace the following 2 lines:

echo Set objvoice = CreateObject("SAPI.SpVoice")>> "Talk_.vbs"
echo ObjVoice.Speak strText>> "Talk_.vbs"

with these codes:

echo Dim objstream, objvoice >> "Talk_.vbs"

echo Set objstream = CreateObject("SAPI.SpFileStream") >> "Talk_.vbs"

echo objstream.Format.Type = 39 >> "Talk_.vbs"

echo objstream.Open "objstream.wav", 3 >> "Talk_.vbs"

echo Set objvoice = CreateObject("SAPI.SpVoice")>> "Talk_.vbs"

echo Set objvoice.AudioOutputStream = objstream >> "Talk_.vbs"

echo ObjVoice.Speak strText >> "Talk_.vbs"

echo objstream.Close >> "Talk_.vbs"

I use 39 for the speech file stream format, which is 48kHz 16bit stereo. For other SAPI5 format type, check out this link:

https://msdn.microsoft.com/en-us/library/ms720595(...

sapimadeit1.pngsapimadeit2.png
author
explosiveghastt (author)2016-03-15

It cant pronounce roflcopter correctly

author
DavidB51 (author)2015-12-12

The following will let you say something as a parameter (e.g. Talk "Hello! How are you!")

@echo off

@mode con cols=55 lines=10

title Talk

color A

:st

cls

cd "%userprofile%\desk*"

if exist Talk_.vbs del Talk_.vbs

copy NUL Talk_.vbs

cls

ping localhost -n 2 > nul

echo strText = ("%~1")> "Talk_.vbs"

echo Set objvoice = CreateObject("SAPI.SpVoice")>> "Talk_.vbs"

echo ObjVoice.Speak strText>> "Talk_.vbs"

cls

cd "%userprofile%\desk*"

start Talk_.vbs

ping localhost -n 3 > nul

del Talk_.vbs

cd..

cls

author
SyedA62 (author)2015-11-22

hi there.. is there any way that I could change to other language and convert the audio to MP3..

author
KatieW11 (author)2015-08-30

thank you so much it works great

author
Jincy AnnaA (author)2015-02-24

But how to use this..just run the Talk.bat file? am just getting a screen with the text i typed and no voice?

author
bayden.falconbridge (author)2015-02-14

I have no idea on how to use this

author
1856682322 (author)2014-05-07

Are there any consumer ready t-t-s programs that allow you to shift between voices and modulations, speeds and timbres? I've been using open-source apps and FL Studio for a while, but perhaps, before I get to construction, what I need might exist.
@noobular

author
dyamini (author)2013-10-14

Hello, could you make the voice program speak with an British accent...preferably a woman's voice?

author
Prof. Pickle (author)dyamini2013-10-14

The language and accent that it speaks in is on your end of the bargain. To access what voices you can change it to, go to Control Panel/Speech Recognition/ and on the left it should say "text to speech". There it should open a properties box where you can change the voice, speed and other details. To download more voices, see here.

author
dyamini (author)Prof. Pickle2013-10-17

Thanks so much for your reply! I was also thinking about making an app and embedding this type of code into the program. I'll have a look into your download link too:-)

author
Prof. Pickle (author)2012-09-19

Hello, I have something like this in my "Mega_Menu" file and I would like to congratulate you on making one.

This is overall a good instructable and I would like to read more in the future.

author
searx (author)2012-09-16

I haven't tried it in any other languages but if you have a specific language you want me to make it in just tell me and I'll do it! I would also be great if you followed me :)

author
blkhawk (author)2012-09-15

I tried this code and my kids and I had some fun! Good project!

author
searx (author)blkhawk2012-09-16

Thanks! Where did you see this instructable posted? It isn't entered in any contests or anything... At least I know that its being viewed! :)

author
vipin786 (author)2012-09-14

cool

author
searx (author)vipin7862012-09-14

Thanks! Did you try it out?

About This Instructable

20,524views

19favorites

License:

Bio: Electrical Engineering Major
More by searx:Sonar Collar for Blind DogsDog Mood Detector (Raspberry Pi)Running Videos on a TI84 Calculator
Add instructable to: