Page 1 of 1

How to loop sound effects? [solved]

Posted: Wed Jun 04, 2014 3:42 am
by Panda_nui
So right now, i've succeeded in creating a decent raining effect in my game and it's time to add the sound effect.
The thing is the sound effect for the rain only lasts for a few seconds and i have a whole rain scene.

Code: Select all

 play sound "music/sfx/rain.wav" loop
This code only plays for the few seconds and I was wondering if there was any way to loop or make that sound effect continue even after that 3 seconds of sfx ended.

Thank you in advance!

Re: How to loop sound effects?

Posted: Wed Jun 04, 2014 5:26 am
by LRH
I think you have to define another sound channel that works like a music channel.

http://www.renpy.org/wiki/renpy/doc/ref ... er_channel

Re: How to loop sound effects?

Posted: Wed Jun 04, 2014 5:37 am
by Asceai
Congratulations, you've found a bug.

You can get around it by using python instead.
$renpy.sound.play("music/sfx/rain.wav", loop=True)

Re: How to loop sound effects?

Posted: Wed Jun 04, 2014 7:56 am
by Donmai
LRH is right. You can define an 'ambient' sound channel with sound looping enabled, exactly like the music channel:

Code: Select all

$ renpy.music.register_channel("ambient","sfx",True,tight=True)
Then you can simultaneously use the 'music' channel to play a sad piano tune, the 'ambient' channel to play the rain noise, and the 'sound' channel to play a thunder sound from time to time. :wink:

Re: How to loop sound effects?

Posted: Wed Jun 04, 2014 11:23 am
by Panda_nui
jksdfas Q7Q <33
@Asceai I used the code you showed me and it worked perfectly! :DD
thank you so much for the help everyone!!