Music won't play after loading

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
HighlightKing
Newbie
Posts: 10
Joined: Fri Feb 23, 2018 2:38 pm
Contact:

Music won't play after loading

#1 Post by HighlightKing »

Hey there!

So my issue is, the following:
You play (music_1 is playing), you reach a choice menu (music_3 starts to play), you make a choice, keep on playing and reach a scene, where music_ 1 starts to play again. Works perfectly, except... if I load a save file that was made BEFORE the choice menu, where music_3 starts, when I reach the choice menu, it won't play.

Now I tried having music_3 start before the choice menu, but it's the same result. If the save file is from BEFORE music_ starts, it won't play when you reach it. There are other music changes that work fine when loaded, except this one.
And with this one, just like with the the rest, the music that's supposed to play is defined right there.

So since this description is somewhat vague, here is my question. What could cause this:

$ renpy.music.play("audio/music_3.mp3", channel='music3', loop=True, fadeout=2, synchro_start=True, fadein=2, tight=None, if_changed=False)
$ renpy.music.set_volume(0.55, 4, channel = "music3")
$ renpy.music.set_volume(0, 4, channel = "music")

to not work, if after a load you reach it in the script? But again, if you play a clean play-through, it works fine.
It's odd that it's possible for the game to reach the code above after loading a save, and just ignore it for some reason.
(Also tried if music_3 is on a channel that hasn't even been used before, like "music5"... same result.)

Thank you for any possible suggestions/ideas.

User avatar
papillon
Arbiter of the Internets
Posts: 4107
Joined: Tue Aug 26, 2003 4:37 am
Completed: lots; see website!
Projects: something mysterious involving yuri, usually
Organization: Hanako Games
Tumblr: hanakogames
Contact:

Re: Music won't play after loading

#2 Post by papillon »

ISTR I had some weird issues occasionally with music after load because renpy would sometimes think the track was already playing, even though it wasn't, and therefore not start it. This was in a game that was using a lot of queuing though.

Have you tried putting in some notifications or popups to test that your code lines are being run and to figure out what music renpy THINKS is playing?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Music won't play after loading

#3 Post by PyTom »

papillon wrote: Sun Nov 28, 2021 4:10 pm ISTR I had some weird issues occasionally with music after load because renpy would sometimes think the track was already playing, even though it wasn't, and therefore not start it. This was in a game that was using a lot of queuing though.
There's a relatively recent fix that might be relevant to this issue, which turned out to be related to the audio channels not necessarily being assigned the same numbers when the game reloads.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: DewyNebula