Is it possible to pause or mute music in Pico-8 from script?
I want to halt the music for a short period when the player dies, and resume it when they respawn. Pause or Mute would both work in this case; I just don't want to restart the whole song every time they die.
This is what I currently do:
-- Player Spawns... music(0) --Player dies music(-1) -- Player Spawns... music(0)
This works sort of. It will record the music position where you are and continue it. Unfortunately there does not seem to be a way to play back according to location in the music position either peek or poke, I checked.
Now while STAT() does contain information about what is playing and where, you cannot reverse to send STAT back to the best of my knowledge.
HOPE THIS HELPS !
A bit brutal (stops sfx as well) but that undocument poke was found some time ago: https://twitter.com/bone_volt/status/1173584954359517184
Ok, @dw817, I didn't know stat could tell you music information. But not exactly what I was looking for.
I did figure something out though. One way pauses the music with a specific memory location with poke. The other way will mute the music, while still playing it. Here is an example cartridge.
The downside to using poke is that it pauses all sound for the cartridge, so you can't play any sound effects while the sound is paused. The other way plays a sound effect over the music. If the sound effect is empty and looping, it can act as "muting" the music.
EDIT: Note that playing an empty sound effect over the music also lets you play sound effects while the music is muted!
[Please log in to post a comment]