Self-voicing gender and history

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
Andredron
Miko-Class Veteran
Posts: 719
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Self-voicing gender and history

#1 Post by Andredron »

https://github.com/renpy/renpy/blob/mas ... oicing.rst

Code: Select all

init python:

    if renpy.windows:
        config.tts_voice = "Mark"
    elif renpy.macintosh:
        config.tts_voice = "Alex"
    elif renpy.linux:
        config.tts_voice = "english_rp"
Hello everyone, I accidentally saw the code from the tts_voice
And studying what kind of voices men and women have in general, I came across a site

https://translated.turbopages.org/proxy ... indows-10/

Code: Select all

Windows 10 versions:

Language, country, or region	Male voice name	Female voice name
Arabic	Not applicable	Hoda
Arabic (Saudi Arabia)	Naayf	Not applicable
Bulgarian	Ivan	Not applicable
Catalan	Not applicable	Herena
Chinese (Simplified)	Kangkang	Huihui, Yaoyao
Cantonese (Traditional, Hong Kong SAR)	Danny	Tracy
Chinese (Traditional, Taiwan)	Zhiwei	Yating, Hanhan
Croatian	Matej	Not applicable
Czech (Czech Republic)	Jakub	Not applicable
Danish	Not applicable	Helle
Dutch	Frank	Not applicable
English (Australia)	James	Catherine
English (Canada)	Richard	Linda
English (Great Britain)	George	Hazel, Susan
English (India)	Ravi	Heera
English (Ireland)	Sean	Not applicable
English (United States)	David, Mark	Zira
Finnish	Not applicable	Heidi
Flemish (Belgian Dutch)	Bart	Not applicable
French (Canada)	Claude	Caroline
French (France)	Paul	Hortence, Julie
German (Germany)	Stefan	Hedda, Katja
German (Switzerland)	Karsten	Not applicable
Greek	Stefanos	Not applicable
Hebrew	Asaf	Not applicable
Hindi (India)	Hemant	Kalpana
Hungarian (Hungary)	Szabolcs	Not applicable
Indonesian (Indonesia)	Andika	Not applicable
Italian	Cosimo	Elsa
Japanese	Ichiro	Ayumi, Haruka
Malay	Rizwan	Not applicable
Norwegian	Jon	Not applicable
Polish (Poland)	Adam	Paulina
Portuguese (Brazil)	Daniel	Maria
Portuguese (Portugal)	Not applicable	Helia
Romanian (Romania)	Andrei	Not applicable
Russian (Russia)	Pavel	Irina
Slovak (Slovakia)	Filip	Not applicable
Slovenian	Lado	Not applicable
Korean	Not applicable	Heami
Spanish (Spain)	Pablo	Helena, Laura
Spanish (Mexico)	Raul	Sabina
Swedish	Bengt	Not applicable
Tamil	Valluvar	Not applicable
Thai (Thailand)	Pattara	Not applicable
Turkish	Tolga	Not applicable
Vietnamese	An	Not applicable
Looking through the code, I saw confirmation that there is a male and female version of the voice.

And the idea came to me, is it possible to automate the code for the characters of the game

Code: Select all

 
 Character(_("Anna"),  color = "#ffffff,  tts_voice ="Zira")

Character(_("Mark"),  color = "#ffffff,  tts_voice ="Mark")
And for the main game, use the default code

Code: Select all

init python:
    if renpy.windows:
        config.tts_voice = "Mark"
Then another question arose in my head, okay, we’ll find a way to prescribe a self voice in a character, but it’s tedious to prescribe manually for everyone. Is it possible to prescribe a gender for each character, and renpy will choose one voice or another

Code: Select all

 
 Character(_("Anna"),  color = "#ffffff,  tts_voice ="female")

Character(_("Mark"),  color = "#ffffff,  tts_voice ="male")


init python:
    if renpy.windows:
        If male:
             config.language.tts_voice = "boy"
        If female:
             config.language.tts_voice = "girl"  
I just wrote the code myself to show what I mean.

Another question is related to history.

Code: Select all

screen history():

    tag menu

    ## Avoid predicting this screen as it can be very
    ## massive.
    predict False

    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0):

        style_prefix "history"

        for h in _history_list:

            windows:

                ## This will properly equalize if history_height is
                ## is set to None.
                has fixed:
                    yfit True

                if h.who:
############################################################################
                    if h.voice and h.voice.filename:                                          ###Here, of course, it is better to put a graphic button, less hassle with setting its location
                        textbutton "Play" action Play("voice", h.voice.filename)
                        
                    textbutton "TTS Voice" action Play("voice", tts.voice)
############################################################################
                    label h.who:
                        style "history_name"
                        substitute False

                        ## Gets the color from the character's who parameter, if it
                        ## installed.
                        if "color" in h.who_args:
                            text_color h.who_args["color"]

                $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                text what:
                    substitute False

        if not _history_list:
            label _("History of dialogs is empty.")
Make a button in the story sound using the self voice.

As a student of foreign languages, such a feature in the project would be very useful to me.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]