[solved] Is it possible to use auto voice and voice tags in the same game?

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
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

[solved] Is it possible to use auto voice and voice tags in the same game?

#1 Post by ComputerArt.Club »

So in my most recent project I experimented with auto voice (define config.auto_voice = "voice/{id}.ogg") and wait voice (default preferences.wait_voice = True), but there were some recordings that I wanted to reuse and the way the auto voice feature worked made this impossible. I then tried using voice tags for those lines, but they would not play. My most recent solution was to use the sound tag instead to call them. This played the files but it is also problematic as those lines will not be muted when users mute voice (given the educational nature of my games, I recommend that players first play with voice and then without it as their reading improves, so this is an important point). The other solution is to duplicate the sound files and then renaming them to their unique IDs (seems wasteful but could result in a better quality product).

Anyone else encounter this issue? Any solutions or suggestions?
Last edited by ComputerArt.Club on Sat Feb 23, 2019 1:57 pm, edited 1 time in total.

User avatar
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: Is it possible to use auto voice and voice tags in the same game?

#2 Post by Remix »

My suggestion would be to point config.auto_voice at a function or mapping that takes the identifier and returns a filename based on it...

Code: Select all

init python:

    auto_voice_remap = { 
        'start_12534213' : 'start_52345122',
        'start_21364213' : 'start_52345122',
        'start_12384213' : 'start_23423423', # etc
    }

    def get_auto_voice_filename( identifier ):
    
        # return remapped filename or normal identifier one ...
        
        return "voice/{}.ogg".format(
            auto_voice_remap.get( identifier, identifier ) )

    config.auto_voice = get_auto_voice_filename
I would also suggest adding a folder in there for current language ( _preferences.language ) just in case you use translations later.
Frameworks & Scriptlets:

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Is it possible to use auto voice and voice tags in the same game?

#3 Post by ComputerArt.Club »

Wow!! Thanks! You’ve done it again Remix! That was just what I needed, very convenient too.

I put it in a separate rpy file and then changed it to init 10 python as at first it wasn’t working, I guess some other init code interferring. Thank you!!!!!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]