Multi-language voice
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.
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.
-
- Newbie
- Posts: 1
- Joined: Mon Jul 16, 2018 11:52 am
- Contact:
Multi-language voice
Hi. I'm wondering what can I do to allow voice for multiple languages. Sorry if this was posted somewhere here on the forums or the documentations but I found nothing about this.
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Multi-language voice
Are you using Auto Voice or just adding various sound clips on certain lines?
If you are using auto_voice, this little snippet will show the filename that Ren'Py is looking for for each line so you can name files accordingly and have them play when needed:
If you are using auto_voice, this little snippet will show the filename that Ren'Py is looking for for each line so you can name files accordingly and have them play when needed:
Code: Select all
default voice_file_string = "voices/{language}/{identifier}.ogg"
default voice_file_name_info = ""
init python:
def get_voice_file_name(identifier):
global voice_file_name_info
vdict = {'identifier' : identifier,
# Amend the dict {lang name : folder name} to suit
'language' : {None:'en', 'Spanish':'es'}[_preferences.language]
}
voice_file_name = voice_file_string.format(**vdict)
if renpy.loadable(voice_file_name):
voice_file_name_info = "Found: {0}".format(voice_file_name)
else:
voice_file_name_info = "Missing: {0}".format(voice_file_name)
return voice_file_name
# Tell Ren'py to *try* to voice every line
# using the above function to locate file
config.auto_voice = get_voice_file_name
screen track_data():
vbox:
area (0.2, 0.0, 0.6, 85)
if voice_file_name_info != "":
text voice_file_name_info
textbutton "English" action Function(renpy.change_language, None)
textbutton "Espanol" action Function(renpy.change_language, "Spanish")
label start:
show screen track_data
"First Line"
"Second Line"
"Last Line"
return
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Multi-language voice
Thank you Remix, it solved my problem as well. But how come "get_voice_file_name" takes a parameter but is called without one?
Where is identifier coming from?
Code: Select all
def get_voice_file_name(identifier):
...
config.auto_voice = get_voice_file_name
neigh
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Multi-language voice
Identifier is a hexadecimal hash (kind of a unique reference string) that Ren'Py uses to reference each line in all the files... So, say for example you were in label start: in script.rpy on a line from Eileen saying "Boo! Wake Up!", Ren'Py might remember that as the string 09ffc3d2 and we can use that reference to associate other things with that line.
When Ren'Py does auto_voicing it calls the function defined in config and passes it that string. I just called it "identifier" as that makes sense to me. The function basically just takes that identifier, adds a folder for language and returns a filename. You could alter the function however you want...
When Ren'Py does auto_voicing it calls the function defined in config and passes it that string. I just called it "identifier" as that makes sense to me. The function basically just takes that identifier, adds a folder for language and returns a filename. You could alter the function however you want...
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot]