Page 1 of 1
Speech synthesis for Ren'py?
Posted: Sun Feb 05, 2017 2:20 am
by DaBackpack
Hi all,
I'm trying to create voice files for a game I'm making and have turned to text-to-speech/speech synthesis options. Specifically, I'm dynamically creating voice lines "on the fly" and don't want to pre-compute all combinations allowed.
I've tried thus far to use gtts and pyttsx but have had trouble getting the dependencies working. ("No module named win32api", "No module named cgi")
I've read:
https://www.renpy.org/doc/html/self_voicing.html
and was wondering if this functionality is exposed to developers, i.e, can I use speech synthesis in my code without installing other modules? Otherwise, has anybody had success using gtts or pyttsx?
Thanks,
dab
Re: Speech synthesis for Ren'py?
Posted: Sun Feb 05, 2017 2:41 am
by Imperf3kt
No idea what gtts or pyttsx are, but you know you don't need to install or modify anything at all, right? Literally all you need to do, is press "v" while running your game. This is persistent, and will be remembered the next time you run the game.
Unless you were saying you dislike the included voice?
Re: Speech synthesis for Ren'py?
Posted: Sun Feb 05, 2017 2:56 am
by DaBackpack
Imperf3kt wrote:No idea what gtts or pyttsx are, but you know you don't need to install or modify anything at all, right? Literally all you need to do, is press "v" while running your game. This is persistent, and will be remembered the next time you run the game.
Unless you were saying you dislike the included voice?
Thanks for your response!
I understand that this is how you turn on self-voicing mode, but there are a few reasons why I don't want this:
1) This places a burden on the user to turn it on manually, whereas I want the voice functionality regardless (even if I turn it on by default, it becomes an option for the user, and they may unintentionally toggle the option without realizing it)
2) From a design standpoint, I don't want this to rely on self-voicing since character voicing is a core mechanic of the game --- if I ultimately do want to include accessibility options, I want "self-voicing mode" separate from the core mechanics of the game
3) There are features of self-voicing mode that I don't necessarily want turned on in the core version of the game --- focusable displayables, for example.
I'm willing to default to this solution, but ideally I want something that doesn't rely on a user-activated game mode.
Re: Speech synthesis for Ren'py?
Posted: Sun Feb 05, 2017 6:53 am
by Imperf3kt
I'm pretty sure there was a way to make sure focusable displays don't get voiced.
I can't say how, as I did this weeks ago, but I was reading the documentation when I discovered how.
There's also some stuff about the self voicing in the game files, though I cannot remember where.
Hope that helps a little.
Re: Speech synthesis for Ren'py?
Posted: Sun Feb 12, 2017 4:12 am
by DaBackpack
Thanks for your response! I looked through the Ren'py source code and figured out what I wanted to do:
Code: Select all
$import functools
$say = functools.partial(renpy.display.tts.speak, force=True)
$say("Hello!")
p "Hello!"
^ which always speaks the parameter ("Hello!") in text-to-speech fashion, regardless if Self-Voicing mode is on.
Just in case anybody else has the same problem!
Re: Speech synthesis for Ren'py?
Posted: Sun Feb 12, 2017 12:20 pm
by PyTom
Note that this is using an unsupported API that I could break at any moment.