Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(-2)

Issue with Self-Voicing in Ren'Py Games - Request for Assistance

Dear Runey

I hope you're doing well. I am writing to bring up an issue I have encountered with the self-voicing feature in the game [Game Name] (e.g., Harem Hotel), which is built using the Ren'Py engine. The issue revolves around certain dialogues, choices, and menu items not being read aloud when the player presses the "V" key, enabling self-voicing with the SAPI (Speech Application Programming Interface) text-to-speech (TTS) system. While some dialogues are properly read aloud, others are not.

Problem Description:

In [Game Name], when I press the "V" key, I expect the game's dialogue to be read out loud using the Windows SAPI TTS system. However, certain dialogues, choices, and menu options are not being read aloud, even though they are visible on the screen. This issue seems to occur in specific parts of the game, and I suspect that some dialogues and menu elements are not properly linked to the TTS system.

Additionally, I would like to clarify that the game is played entirely using the keyboard when the self-voicing mod is enabled. This means that when I press Enter, the dialogue advances to the next line, and when there is a list of choices, I can navigate through them using the arrow keys (up/down). However, the self-voicing feature does not read some parts of the dialogue, menus, or choices during this process.

It appears that the self-voicing feature might not have been fully implemented for all dialogues, choices, or menus in the game. While the function works fine for some parts of the game, other parts (such as choices and menus) seem to be missing from this feature.

Potential Causes:

There could be a few reasons why some dialogues, choices, and menus are not being read aloud:

1. 

Incomplete Implementation of Self-Voicing:

Some dialogues, choices, or menu items may not be connected to the self-voicing system, meaning they are not marked for reading aloud with SAPI TTS.

2. 

Misconfiguration in Ren'Py Script:

There may be sections in the Ren'Py script where the dialogues, choices, or menu items are not tied to the TTS system or the corresponding "sapi" voice is missing.

3. 

Improper Text Formatting for TTS:

Some dialogue or menu text may not be formatted in a way that is recognized by the TTS system. For example, text that is inside menus or quick choices might not be processed correctly for self-voicing.

4. 

Windows SAPI TTS Engine Issues:

There could also be issues related to the Windows TTS engine (e.g., a missing or incompatible voice file).

Suggested Solutions:

1. Verify if All Dialogues, Choices, and Menus are Linked to the TTS Function

The first step is to ensure that every piece of dialogue, choice, and menu item in the script is properly linked to the self-voicing feature. Ren'Py allows the developer to define a voice that should be used for TTS. If this is not done consistently, some dialogues or menu items may not be read aloud.

Example Fix for Dialogue:

To ensure TTS is activated for all dialogues, make sure the voice property is consistently applied to all dialogue characters. Here’s an example of how to define it in the Ren'Py script:

renpy

define e = Character('Eileen', voice="eileen.ogg")  # TTS voice file for the character

label start:

    e "Hello, welcome to the hotel!"  # This dialogue will be read aloud using TTS.

    e "How are you feeling today?"

In this example, the voice file eileen.ogg is linked to the character Eileen. Ren'Py will use the specified voice file to read the dialogue aloud.

2. Ensure Choices and Menus are Included in the TTS System

It's important to make sure that choices and menus are also connected to the TTS system, as these are often missed in the script. You can achieve this by adding a TTS function specifically for these interactive elements.

Example Fix for Choices:

You can define a function to ensure that choices are also read aloud. Here's an example of how to ensure that the TTS reads the choices:

renpy

label start:

    menu:

        "How are you feeling today?":

            "Good":

                e "That's great to hear!"

            "Not so good":

                e "I'm sorry to hear that."

Ensure that each choice option triggers TTS:

You can also create a function to read the menu choices aloud:

renpy

init python:

    def speak_choice(text):

        renpy.say("sapi", text)  # Forces the text to be read aloud when a choice is made

label start:

    menu:

        "How are you feeling today?":

            "Good":

                $ speak_choice("Good")  # This choice will trigger TTS

                e "That's great to hear!"

            "Not so good":

                $ speak_choice("Not so good")  # This choice will trigger TTS

                e "I'm sorry to hear that."

In this example, the choice options will trigger TTS, making sure that choices are also read aloud.

3. Create a Global TTS Function for All Text Elements

To ensure that all dialogue, choices, and menus are read aloud consistently, you can create a global function that will force TTS for every text element in the game. This ensures that even non-character specific text (such as UI elements or custom menus) will be read aloud.

Example Global Function:

You can add this function to the init python block in your script to make sure that every line of text is read aloud:

renpy

init python:

    def speak_text(text):

        renpy.say("sapi", text)  # Forces the text to be read aloud using TTS.

label start:

    $ speak_text("Hello, welcome to the hotel!")

    $ speak_text("How are you feeling today?")

This function ensures that any text you call using speak_text("Your Dialogue Here") will be automatically read aloud by the TTS system, including choices and other menu text.

4. Ensure Proper Dialogue and Menu Formatting

Some dialogues and menus might not be automatically picked up by the TTS system. You can manually force the TTS to read specific text by using the window hide and window show commands. This can be useful for cases where text is displayed outside of the usual dialogue flow (e.g., in quick menus).

Example with window hide and TTS for Menus and Choices:

r

label start:

    window hide

    e "Welcome to the hotel! This text will be read aloud by TTS."

    window show

    

    menu:

        "How are you feeling today?":

            window hide

            "Good":

                $ speak_choice("Good")  # This choice will trigger TTS

                e "That's great to hear!"

            "Not so good":

                $ speak_choice("Not so good")  # This choice will trigger TTS

                e "I'm sorry to hear that."

            window show

Using window hide ensures that the TTS system can handle the text properly.

5. Test for SAPI Compatibility

Ensure that the Windows TTS engine is functioning properly. Sometimes issues can arise if there are missing or outdated voices on the system. It’s a good idea to check that the necessary voices (e.g., Microsoft David, Zira, etc.) are installed and working properly.

You can test the functionality of Windows TTS outside the game (e.g., using Notepad) to confirm that the issue is not related to TTS itself.

Conclusion:

To address the issue with self-voicing, I would suggest ensuring that all dialogues, choices, and menus are properly linked to the TTS system. This can be done by ensuring the correct configuration of voices in the Ren'Py script and using global functions to enforce TTS for all text in the game.

Please let me know if you need any additional information or clarification. I would be happy to assist further if needed.

Best regards,

(-1)

Very long article, it might be better suited to Discord. Developers gather there more than here.

Good points nevertheless. I have not seen the source code of HH, so I do not know how self voicing is used there. I guess proofreaders and translators need to be made aware of this so they check also correct markings for self voicing.

I play on Linux, the self voicing works, I have mistakenly turned it on a few times. I have assumed it is always the same voice, maybe that TTS only works on Windows?

(-1)

on windows they use sapy voices that are built into windows, I haven't used linux so I'm not sure how much I would read there but maybe I'll try that.

(3 edits) (+4)

My man, don't use ChatGPT to write comments for you. And if you do, proof read it first. "In game [Game Name]"? Come on. ChatGPT is suggesting things that would take years to complete if I solely focused on it. 

In any case, I have never touched the TTS as it is something Ren'py handles and is automatic. As far as I am aware, I can't do anything to the TTS except disable it.

a couple of games are written in the same programming language, for example Secret Island, it uses everything the same but on it all the elements are visible to the automatic reader that is in the program, while in the harem hotel game one part is reviewed and the other is not, I really like this type of games and there are not many of them that are good and need to be updated, chat gpt did help me partially but only because English is not my primary language.

(1 edit) (+1)

I see. I'm not sure why this is happening for you, or if it is an issue with the game entirely. 

Are you asking for it to be fixed because you prefer TTS or because you need to play because you are visually impaired?

(+1)

I'm blind that's why I'm most interested if tts can be fixed, because a lot of things are not read, for example to me when choosing in some dialogue, and such things, the game is very good, I can say that because I played until part while tts could read certain things

(+3)

I see, I've been getting a lot of requests from visually impaired people to address errors in the TTS. I'm quite behind on work at the moment, but if I have some spare time it will be something I look into. Thanks for the report!