Multi-language voice

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
User avatar
Eyzi
Regular
Posts: 32
Joined: Fri May 15, 2015 12:43 am
Organization: Moonlit Works
Discord: Eyzi#3994
Contact:

Multi-language voice

#1 Post by Eyzi »

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.
Image

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Multi-language voice

#2 Post by Divona »

Ren'Py translation allow the files to be translates, which means if you put the other language voices in their translation folder. Example:

None language: "game/voices/line0001.ogg"
Japanese language: "game/tl/voices/japanese/line0001.ogg"

In theory, it should automatically play the translation voices when player choose Japanese as their prefer language.

But that would disrupted the possibility of player choosing English as dialogue and UI and want just Japanese voice, however. Perhaps will have to make a function that supply the path to the voice files depending on which voice language is choosen?

Here is a sample code, have not test it, just a rough idea:

Code: Select all

init python:
    def get_voice(voice_id):
        
        $ path = ""
        
        if _preferences.language == "None":
            path = "en"
        elif _preferences.language == "Japanese":
            path = "jp"
        
        if path != "":
            path = path + "_line" + voice_id + ".ogg"
            
        return path

label start:

    voice get_voice("0001")
    "Hello world."
Completed:
Image

User avatar
Eyzi
Regular
Posts: 32
Joined: Fri May 15, 2015 12:43 am
Organization: Moonlit Works
Discord: Eyzi#3994
Contact:

Re: Multi-language voice

#3 Post by Eyzi »

Hey. Thanks for the reply. That's what I was looking for. But will it still work if say the players change their preferred voice language midway through? I will try and test that later. Thank you!
Image

Post Reply

Who is online

Users browsing this forum: No registered users