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

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
crackshot91
Newbie
Posts: 4
Joined: Sun Aug 07, 2011 1:31 am
Contact:

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

#1 Post by crackshot91 » Sat Apr 23, 2016 2:56 am

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?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

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

#2 Post by PyTom » Sat Apr 23, 2016 11:56 am

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.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

crackshot91
Newbie
Posts: 4
Joined: Sun Aug 07, 2011 1:31 am
Contact:

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

#3 Post by crackshot91 » Sat Apr 23, 2016 11:00 pm

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?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

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

#4 Post by PyTom » Sun Apr 24, 2016 12:14 am

I'm pretty much just a much a novice when it comes to Windows 10's SAPI support. I have no idea.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

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

#5 Post by DragoonHP » Sun Apr 24, 2016 2:49 am

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.

crackshot91
Newbie
Posts: 4
Joined: Sun Aug 07, 2011 1:31 am
Contact:

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

#6 Post by crackshot91 » Sun Apr 24, 2016 8:21 pm

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

User avatar
DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

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

#7 Post by DragoonHP » Sun Apr 24, 2016 8:37 pm

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)

crackshot91
Newbie
Posts: 4
Joined: Sun Aug 07, 2011 1:31 am
Contact:

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

#8 Post by crackshot91 » Sun Apr 24, 2016 10:51 pm

Ahh! It worked!!! You rock. :D

maxlefou
Newbie
Posts: 4
Joined: Thu May 23, 2019 4:02 pm
Contact:

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

#9 Post by maxlefou » Tue Jun 30, 2020 6:01 am

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?

Post Reply

Who is online

Users browsing this forum: No registered users