Ren'Py play music a certain number of times

UnderTheStairs

Newbie
Game Developer
Jul 25, 2021
59
1,250
I would like the song to play twice and stop, but with my code, the queue stops playing once you press Back.

queue music ["music/Piano1.mp3", "music/Piano1.mp3"] noloop
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
It seems to be a quirk (maybe a bug?) of using rollback when a non-repeating sound channel is still playing.

I just tried this code:

Python:
label start:

    scene black with fade

    "*** START ***"

    "Before music starts to play."

    play music "music/one.ogg" noloop
    queue music "music/two.ogg"  noloop

    "Music has started."
    "Music continues to play."
    "Music is still playing."
    "You can rollback now."

    "*** THE END ***"
    return

And it breaks exactly how you describe... the music stops when you rollback. If you remove noloop, it works fine.
It also breaks if you try play sound instead of play music, I assume because the sound channel defaults to noloop. I tried queue music ["music/one.ogg", "music/two.ogg"] noloop too.

There may be some sort of work-around, but I've tested it not working with RenPy 7.3.5 and 7.4.8. So if it's a bug, it's a long standing bug. Maybe ?
 
  • Like
Reactions: UnderTheStairs

UnderTheStairs

Newbie
Game Developer
Jul 25, 2021
59
1,250
I'm not a damn composer to calculate the musical background to the smallest detail!! :LOL:
Thanks for the clarification