Page 1 of 1

Force sound to play fully (for lightning with sound via ATL)

Posted: Tue Jul 27, 2021 1:15 pm
by MoonByte
I have a "lightning with sound" code which looks like this:

Code: Select all

init -1 python:
    def thunder_sound(trans, st, at):
        renpy.play("audio/sound/thunder.mp3", channel="sound")

image lightning:
    choice: #weight of choice is 1
        "lightning.png"
        alpha 0.0
        function thunder_sound
        0.5 # show nothing for 0.5 seconds


    choice 0.1: #weight of choice is 0.1
        "lightning.png"
        alpha 0.0
        function thunder_sound
        linear 0.3 alpha 1.0
        linear 0.3 alpha 0.0

    choice 0.1:
        "rev_lightning"
        alpha 0.0
        function thunder_sound
        linear 0.3 alpha 1.0
        linear 0.3 alpha 0.0
It works just fine, like it flashes, no errors and I technically hear a sound...
And I say technically, cause the sound plays for maybe half a second and then just stops. I assume something in that code forces the sound to stop the second that the animation is done? Which obviously I don't want, I want the thunder sound to play fully. And just to clarify: it's NOT that the sound stops because the next lightning happens. It just cuts off instantly, even when the next flash is 12 seconds away.

The only mention of "force play" for sound that I could find was this Reddit thread which suggests to queue sounds. But using the above function with queue gives me errors.
Anyone got any idea on what to do?