Page 1 of 1

Self-voicing on windows 10. Changing the voice gender?

Posted: Sat Apr 23, 2016 2:56 am
by crackshot91
Many games developed using Ren'Py have a self-voicing feature (Press V and you'll hear it), but I can't seem to be able to make the games use the female voice (Microsoft Zira). No matter what setting I choose in the voice settings control panel, the games use Microsoft David's voice. How do I get Ren'Py games to use a different voice?

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Sat Apr 23, 2016 11:56 am
by PyTom
I don't know. To play voice on window, we use the wscript program to run lib/windows-i686/say.vbs . You can look at that to see what's going on, but I think it's supposed to use the default voice.

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Sat Apr 23, 2016 11:00 pm
by crackshot91
Unfortunately I am a strict novice, so I'm not sure how to go about investigating this. By "default voice", I'm assuming you mean Microsoft David? Is there a way to make Zira the default voice? Could I maybe uninstall Microsoft David's voice?

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Sun Apr 24, 2016 12:14 am
by PyTom
I'm pretty much just a much a novice when it comes to Windows 10's SAPI support. I have no idea.

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Sun Apr 24, 2016 2:49 am
by DragoonHP
So I tried my hand at it.

Change say.vbs to

Code: Select all

Text = WScript.Arguments(0)
Speaker = WScript.Arguments(1)

Set s = CreateObject("SAPI.SpVoice")

For Each Voice In s.GetVoices
    I = I + 1

    If InStr(Voice.GetDescription, Speaker) > 0 Then
        Set s.Voice = s.GetVoices.Item(I-1)
        Exit For
    End If
Next

s.Speak Text

Not the best way but it should work. This script basically checks if the required voice pack is installed on the system. If yes, it uses that voice, otherwise it uses the default voice.

And for this to work, change the last line in default_tts_function to

Code: Select all

process = subprocess.Popen([ "wscript", renpy.exports.fsencode(say_vbs), renpy.exports.fsencode(s), renpy.exports.fsencode("Zira") ])
Or maybe it would be better to create a config variable for sapi voice. I dunno.

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Sun Apr 24, 2016 8:21 pm
by crackshot91
You guys are gonna think I'm stupid, but I'm not actually developing a game myself. I'm just trying to get a couple Ren'Py games to use a different voice. Particularly Starlight Vega. I posted this question in the Starlight Vega forum, but I've yet to receive a response.

So, I edited the say.vbs file to reflect what you suggested, DragoonHP, but I'm unclear about what you mean by "changing the last line in default_tts_function". Is this a user-configurable thing, or does the dev need to do this? Sorry for the embarrassingly nooby questions. I'm just a dumb end user looking for a solution. :P

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Sun Apr 24, 2016 8:37 pm
by DragoonHP
It will be a better if the devs change it. But in your case, you can just change the second line to

Speaker = "Zira"

directly. (Instead of Zira, you can use other names like Hazel, David, Sam etc)

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Sun Apr 24, 2016 10:51 pm
by crackshot91
Ahh! It worked!!! You rock. :D

Re: Self-voicing on windows 10. Changing the voice gender?

Posted: Tue Jun 30, 2020 6:01 am
by maxlefou
Sorry to necropost but i'm having the same problem.

While the block code about say.vbs seems to be already set in renpy 7.3.5.606, the other line in the default_tts_function wasn't. So i did what it says, but it causes renpy to not start at all (not just the game, the whole renpy launcher as well) without logging anything. putting back the original line fixes it but well, back to start then.

Does anyone find an idea on how to fix it?