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:

make computer speak

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.

make computer talk

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.

speak computer

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

Related Posts

Comments

49 Responses to “How to make your computer talk/speak what you type”

  1. Voltz83 said on :

    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


  2. Odoiporos said on :

    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????


  3. Odoiporos said on :

    ok, ok. I found it!!!
    the ” character was wrong. Ok, it works great! Thanks…


  4. Odoiporos said on :

    How can I change the voice????


  5. John Williams said on :

    Your instructions worked well, the computer speaks, my kids thought it was very cool.


  6. Randy Brinkley said on :

    i tried to do this but i keep getting the same error codeINE: 2
    CHAR: 18
    ERROR: INVALID CHARACTER
    CODE: 800A0408


  7. Jenn said on :

    I think it’s only for XP computers??? Won’t work on vista for me anyway.


  8. Herman Mertens said on :

    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


  9. Fred said on :

    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


  10. Aaron said on :

    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.


  11. Anonymous said on :

    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.


  12. Babak said on :

    You have to change all ” to ”
    Or you will get a character error.


  13. bish said on :

    ummmmmm its not working for me theres an error same as all the other peoples on line two

    please explain


  14. markell said on :

    Thanks it works


  15. Al said on :

    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.


  16. Jeff said on :

    Hey, very cool! I’m driving my wife crazy.

    Same question as Al: can we keep the box from disappearing?


  17. akishore said on :

    @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


  18. Michael said on :

    This is so cool! Can you tell us how to make it loop? thanks.


  19. G said on :

    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


  20. ed said on :

    Really cool thanks my kids got a kick out this.


  21. Dig said on :

    this is pretty cool! but the voice isnt
    is there a website to change the voice?


  22. krystaljg12 said on :

    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????


  23. home loan said on :

    Lovely. Great site.


  24. danielle said on :

    this is cool and effective but how can you change the voice?


  25. sound2man said on :

    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


  26. Richard said on :

    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?


  27. ocracoke387 said on :

    Have tried all suggestions listed and changed fonts…I still get the same error everyone else does…what is the problem…can anyone help??


  28. Me said on :

    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.


  29. Justin said on :

    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.


  30. joyscog said on :

    it is not showing me any typing box and i did everything right:(


  31. GKL® said on :

    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


  32. David said on :

    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


  33. particle man said on :

    how do you change the voice?


  34. FEEX said on :

    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 “.


  35. Carlea said on :

    This is great! Now I can hear someone tell me how wonderful I am all day…every girls dream.


  36. ajaunna said on :

    mine is not working it says:

    LINE: 2
    CHAR: 18
    ERROR: INVALID CHARACTER
    CODE: 800A0408
    SOURCE: MICROSOFT VBSCRIPT COMPILATION ERROR


  37. Lindsey said on :

    Thanks for this. Can you tell me how to make the voice speek when the computer is restarted?


  38. Mickey said on :

    Thanks so much for this!!! I just had surgery on my throat and can’t talk write now so this will help me tremendously!!!


  39. Phillip said on :

    I used something that makes it reappear after talking, but it reappears after you close it! So I cant close it! nooo!


  40. Sleepless in Seatle said on :

    Thanks, this is way cool!


  41. Joe said on :

    what can be done to the input box to increase the amount of text you can type?


  42. Dunc said on :

    Thanks this is awesome my lil girl just loves when the computer talks to her!

    thinks pc is now really called claire : ) priceless


  43. :3 said on :

    This is SO SUPERB!!! is there anyway to change the talking voice?


  44. Jake said on :

    This is awesome, but is there a way of extending the limit on how much can be typed/spoken. It wont let me input more than 41 words at a time…


  45. Hunter said on :

    You can also do this on a mac, just open Terminal and type- say i want it to say something – and replace i want it to say something with what you want it to say.


  46. Janey said on :

    My OS is Vista Ultimate 64bit. I found the solution and it work on my computer.

    The solution for the
    “LINE: 2
    CHAR: 18
    ERROR: INVALID CHARACTER
    CODE: 800A0408
    SOURCE: MICROSOFT VBSCRIPT COMPILATION ERROR”

    You have to physically retype the all “.

    So it would be like this:
    Dim message, sapi
    message=InputBox(”Enter the text you want spoken”,”Speak This”)
    Set sapi=CreateObject(”sapi.spvoice”)
    sapi.Speak message


  47. alljon said on :

    How can I change the voice????


  48. HM said on :

    Please can someone upload a newer version with different voice? This voice is scary…


  49. sam said on :

    it keeps on saying

    LINE: 2
    CHAR: 18
    ERROR: INVALID CHARACTER
    CODE: 800A0408
    SOURCE: MICROSOFT VBSCRIPT COMPILATION ERROR


Please post your comments/suggestions!