Discuss Scratch

supercoder4
Scratcher
35 posts

Pause music?

I'm working on a game that needs to pause the music, or it will just sound bad. I've been trying to do this for a while, but no luck yet. Is there anything I'm missing? Thanks!
Hero_man_555
Scratcher
72 posts

Pause music?

I'm assuming you want the music to pick right off where it left of, but just incase you want something simpler, you'll just need to make a variable that when the game is paused, it stops all sounds and vice versa. If you want the music to keep playing from the same section, I'd have no idea how to do that, but there's probably some way to log what time/beat the song stopped on.
supercoder4
Scratcher
35 posts

Pause music?

Yea I want it to stop, then start at the same spot. I've seen someone who just pauses it by stopping it then turning the volume down to zero, playing it until you stopped, then put thevolume back up. Also, nice profile pic
supercoder4
Scratcher
35 posts

Pause music?

Lol both of our profile pics are from TF2
deck26
Scratcher
1000+ posts

Pause music?

If you're just using the play sound blocks you can't pause the music - the blocks always play the sound from the start.

Last edited by deck26 (Oct. 27, 2021 16:40:18)

Hero_man_555
Scratcher
72 posts

Pause music?

supercoder4 wrote:

Yea I want it to stop, then start at the same spot. I've seen someone who just pauses it by stopping it then turning the volume down to zero, playing it until you stopped, then put thevolume back up. Also, nice profile pic

Thanks for the compliment

I think one possible solution would be the break up the song into a bunch of small parts and have those play one after another. It won't be exact but it won't start from the beginning. Not sure if this will impact project size greatly though.
Concon99
Scratcher
6 posts

Pause music?

You could just change the Volume to -100 when you pause
Hero_man_555
Scratcher
72 posts

Pause music?

Concon99 wrote:

You could just change the Volume to -100 when you pause

Yeah, but that'll mean that the music will keep going while the game is still paused, and the OP doesn't want the music to skip ahead while the game is paused. (I think)
MarioFan792
Scratcher
14 posts

Pause music?

You could just do this:
definepausesoundsetvolumeto0%setpitcheffectto-1/0defineresumesoundsetvolumeto100%setpitcheffectto0
You would have to do the music in a separate spite because then all the sounds in the sprite would pause.

Hope this helped
EpicGhoul993
Scratcher
1000+ posts

Pause music?

MarioFan792 wrote:

You could just do this:
definepausesoundsetvolumeto0%setpitcheffectto-1/0defineresumesoundsetvolumeto100%setpitcheffectto0
You would have to do the music in a separate spite because then all the sounds in the sprite would pause.

Hope this helped
Not really effective if you pause for too long.
Tbh I think #6 has a good solution, though I don't know how to trim perfectly in Scratch.
supercoder4
Scratcher
35 posts

Pause music?

Hero_man_555 wrote:

Concon99 wrote:

You could just change the Volume to -100 when you pause

Yeah, but that'll mean that the music will keep going while the game is still paused, and the OP doesn't want the music to skip ahead while the game is paused. (I think)
Im new in talking to people on here, so what does OP mean? The creator of the thread?
supercoder4
Scratcher
35 posts

Pause music?

MarioFan792 wrote:

You could just do this:
definepausesoundsetvolumeto0%setpitcheffectto-1/0defineresumesoundsetvolumeto100%setpitcheffectto0
You would have to do the music in a separate spite because then all the sounds in the sprite would pause.

Hope this helped
Yea it does kinda work, but for not for a long time

Powered by DjangoBB