Page 1 of 1

Making typing sounds compatible with automatic pauses

Posted: Sat Oct 22, 2022 9:06 pm
by pickledylans
Hi everyone! So theres two codes ive found that im using rn, one is to make sounds when the text comes up on screen (think pheonix wright) and one is to create automatic pauses when theres commas and periods.

The only problem is the sound continues during pauses, which creates a weird effect. Obviously something needs to change... but i dont know what to do. any help is appreciated :)

Code: Select all

# Text Sound system
init python:
    def A1Voice(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "show_done":
            renpy.sound.play("audio/A1.ogg",loop=True)
        elif event == "slow_done":
            renpy.sound.stop()

Code: Select all

#Text Speed system
init python:

    def slow_punctuation(str_to_test):
        str_to_test = str_to_test
        return str_to_test.replace(
            ", ", ",{cps=3} {/cps}").replace(
            "... ", "...{cps=1.3} {/cps}").replace(
            ". ", ".{cps=2} {/cps}").replace(
            "! ", "!{cps=2} {/cps}").replace(
            "? ", "?{cps=2} {/cps}").replace(
            "St.{cps=2} {/cps}", "St. ").replace(
            "Mr.{cps=2} {/cps}", "Mr. ").replace(
            "Ms.{cps=2} {/cps}", "Ms. ").replace(
            "Mx.{cps=2} {/cps}", "Mx. ").replace(
            "Dr.{cps=2} {/cps}", "Dr. ")

    config.say_menu_text_filter = slow_punctuation

Re: Making typing sounds compatible with automatic pauses

Posted: Sun Oct 23, 2022 5:43 am
by Ocelot
Why change of cps and not timed pause? I doubt you can call your callback just in the middle of the text without any pauses.

Re: Making typing sounds compatible with automatic pauses

Posted: Sun Oct 23, 2022 11:58 am
by pickledylans
Ocelot wrote:
Sun Oct 23, 2022 5:43 am
Why change of cps and not timed pause? I doubt you can call your callback just in the middle of the text without any pauses.
Its just the only method for a system that automatically pauses during commas and periods i could personally find. If theres a different way of doing it id love to hear it!