[SOLVED] I want sounds to overlap

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
Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

[SOLVED] I want sounds to overlap

#1 Post by Nero »

I was wondering is there a way to make sound effect on single channel to overlap each other.

For example I have a card draw effect that is set to 0.1 loop delay and duration of .mp3 is 1 second so if I run this code it will work but I will get this choppy-breaking sound, same as you would get by spamming the replay button on your media player if you know what I mean.

So what I want is even if my code loop is set to 0.1 seconds the duration of sound effect should be played until the end no matter if I want to play same sound effect over and over.

Code: Select all

init python:
    def SFX_Play(sfx=None,volume=1.0,musicChannel=None):
        # Set volume of SFX
        renpy.music.set_volume(volume, channel=musicChannel)

        # Take one of possible sound effects
        if sfx != None:
            soundToPlay = random.choice(sfx)

            # Play the generated sound
            renpy.play(soundToPlay,channel=musicChannel)


    SFX_Play(["sfx1.mp3", "sfx2.mp3"], 1, "sounds")

Anyone can help with this please?
Last edited by Nero on Wed Aug 03, 2022 8:46 am, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2407
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: I want sounds to overlap

#2 Post by Ocelot »

https://www.renpy.org/doc/html/audio.html
Documentation wrote:In addition to the normal channel, there is one special channel, audio. The audio channel supports playing back multiple audio files at one time, but does not support queueing sound or stopping playback.
< < insert Rick Cook quote here > >

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: I want sounds to overlap

#3 Post by Nero »

Oh I thought those channel names are just strings with no effects. Naming my channel to "audio" solved the problem. Thanks Ocelot.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]