How to make your computer talk/speak what you type
Posted on November 3, 2008 at 5:25 am
Here’s a cool little feature of Windows that can be abused so that you can make your computer talk or speak whatever you tell it! This method takes advantage of a built-in API installed on most Windows XP machines called SAPI (Speech Application Programming Interface).
The Microsoft Speech API is what is used for the Narrative accessibility feature built into Windows. You can also write programs that call the API, which would allow you to let your applications speak.
But making your computer say what you want is pretty easy actually! Here’s how you do it:
Step 1: Open Notepad and paste the following text into a new document:
Dim message, sapi
message=InputBox(”Enter the text you want spoken”,”Speak This”)
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak message
It should basically look something like this:
Now when you go to save the file, give it any name, but make sure you also type .VBS after the name. Also, for the Save as type box, choose All files instead of the default Text Documents.
Now double-click on the VBS file and you should see a input box where you can type in the text you want spoken! Go ahead and type something and click OK.
![]()
That’s it! Your computer will speak to you in the default voice, which for me was some scary seductive male type of voice! What about yours? Enjoy (This would be fun to do on someone else’s computer as a joke.)
» Filed Under Fun Stuff
Save this page |
Stir it up on Mixx |
|
Add to Reddit |
Related Posts
- How to change the default program to open a file with
- How to open multiple programs in Windows at once
- How to quickly paste copied text to Notepad
- Hide and lock text files in Windows
- Extract text from PDF, DOC, HTML, CHM, and RTF files
Save this page
Stir it up on Mixx
Add to Reddit






















if I put code like this:
Dim message, sapi
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak “Who are you?”
And then I set it to run at restart on someone’s pc, so when it restart… Will it work???
Thank
not working for me…
it says:
LINE: 2
CHAR: 18
ERROR: INVALID CHARACTER
CODE: 800A0408
SOURCE: MICROSOFT VBSCRIPT COMPILATION ERROR
can you tell me what am I doing wrong????
ok, ok. I found it!!!
the ” character was wrong. Ok, it works great! Thanks…
How can I change the voice????
Your instructions worked well, the computer speaks, my kids thought it was very cool.
i tried to do this but i keep getting the same error codeINE: 2
CHAR: 18
ERROR: INVALID CHARACTER
CODE: 800A0408
I think it’s only for XP computers??? Won’t work on vista for me anyway.
Thanks, the kids love it, especially since I added a loop:
Dim message, sapi
message=InputBox(”Enter the text you want spoken”,”speak this”)
set sapi=CreateObject(”sapi.spvoice”)
For i=1 to 10
sapi. Speak message
Next
Here is the corrected code:
Dim message, sapi
message=InputBox(”Enter the text you want spoken”, “Speak This”)
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak message
Randy if you copied and pasted the text from the website you will have to go back in and change the ” marks to your own. You will manually have to type them into the code. They dont copy and paste right. That should fix your problem.
Everyone, if you receive the error message when attempting to open the file, replace the copied quotation marks (all of them) by pressing the quotation key when each is highlighted. It doesn’t recognize the quotations provided.
You have to change all ” to ”
Or you will get a character error.
ummmmmm its not working for me theres an error same as all the other peoples on line two
please explain
Thanks it works
Hey this is great. I was wondering if there is something I can add to the script that will keep the box from disappearing after I enter the phrase I want spoken.
Hey, very cool! I’m driving my wife crazy.
Same question as Al: can we keep the box from disappearing?
@Jeff - You can prevent the box from disappearing by putting the entire thing in a For or While loop. You’ll need to know a bit of VBScript code in order to do this though. I’ll see if I can try to modify it myself and then post in here in the comments. But if you are technically savvy, you can search in Google for “VBScript while loop”, etc and see if you can get it to work. Feel bad for the wife! haha
This is so cool! Can you tell us how to make it loop? thanks.
when you add:
Dim message, sapi
message=InputBox(”Enter the text you want spoken”, “Speak This”)
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak message
change manually change the ” because it reads it wrong in notepad…then it should work
Really cool thanks my kids got a kick out this.
this is pretty cool! but the voice isnt
is there a website to change the voice?
not working for me…
it says:
LINE: 2
CHAR: 18
ERROR: INVALID CHARACTER
CODE: 800A0408
SOURCE: MICROSOFT VBSCRIPT COMPILATION ERROR
can you tell me what am I doing wrong????
Lovely. Great site.
this is cool and effective but how can you change the voice?
Ran this script in a remote script program to wierd out my coworkers. With a slight modification, you can make it say anything you like without a popup.
Dim message, sapi
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak “INSERT TEXT HERE
It works great. I have vista and did have to delete the quotation marks and retype them in.
Is there a way to record it in a .wav or similar file?
Have tried all suggestions listed and changed fonts…I still get the same error everyone else does…what is the problem…can anyone help??
heres my code, i just added a loop
Dim message, sapi
Do
message=InputBox(”Enter the text you want spoken”, “Speak This”)
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak message
Loop
then the dialogue box reappears after the speech.
I lost my voice so I made a slight twist on this.
Dim message, sapi
do
message=InputBox(”Enter the text you want spoken”,”Speak This”)
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak message
loop until message = “”
Will keep going until you hit cancel, close it with the x in the top right, alt+f4, or just hit OK or enter on a blank box.
It just sat in the background while I was working and then could alt+tab when I needed it.
Oh, and notepad doesn’t have “fonts”, so I don’t know what you were using, unless it was wordpad.
it is not showing me any typing box and i did everything right:(
Hi Sound2Man,
Can you give me somes tips or the code you used for the below????? as I have been wanting to do that for ages at work…
Cheers
GKL®
———————
sound2man said on : February 4th, 2009 at 12:04 pm
Ran this script in a remote script program to wierd out my coworkers. With a slight modification, you can make it say anything you like without a popup.
Dim message, sapi
Set sapi=CreateObject(”sapi.spvoice”)
sapi.Speak “INSERT TEXT HERE
Hi Guys,
I am running Windows XP
I type the vbs code as instructed and I changed the quotation marks and I still am getting an error Line 2 Character 18 Error 800A0408
Origen Error in the compilation of Microsoft VBscript
how do you change the voice?
Guys, what you have to do is copy and past the code into Notepad, but delete and re-make the quotes (”")….must re-make all of the “.
This is great! Now I can hear someone tell me how wonderful I am all day…every girls dream.