6

So basically I'm making a program that talks whatever I programmed it to say, I'm making it in notepad on windows and it's a VBS script but I want to know if I can change the pitch of the voice or how it sounds in general? Here is the script:

Dim msg, sapi
Set sapi=creatobject("sapi.spvoice")
Sapi.speak"Hello world"
Lol=msgbox("Request done.")

Then i save it as .VBS in all files.

4

3 Answers 3

12

First of all, there is an error in your code. Change creatobject to createobject.

And now, for the main code: ...

Dim msg, sapi
Set sapi = createObject("sapi.spvoice")
Set sapi.Voice = sapi.GetVoices.Item(1)
sapi.Speak "Hello world"
Lol = msgbox("Request done.")

Make sure to put this line Set sapi.Voice = sapi.GetVoices.Item(1) before the sapi.Speak "...", otherwise the voice will still remain the same.

1

I guess you can always do it the easiest method which is just changing the default TTS voice. By going to speech recognition, and then text to speech.

0
Dim Zira David

Zira's Voice
Set Zira = CreateObject("SAPI.spVoice")
Set Zira.Voice = Zira.GetVoices.Item(1)
Zira.Rate = 2
Zira.Volume = 70

Zira.Speak "My Name is Zira."

This another voice

Dim David

David's Voice
Set David = CreateObject("SAPI.spVoice")
Set David.Voice = David.GetVoices.Item(0)
David.Rate = 2
David.Volume = 100

David.Speak "My Name is David. It's nice to meet you!"

if you want to make your computer greet you when open the computer just choose any 1 from these two and open run box by pressing the winows button + R and type AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup and enter

Note: save these code in notepad then click on save as enter any name after the type .vbs then click on all files.all done

Not the answer you're looking for? Browse other questions tagged or ask your own question.