Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Imported music can't loop without interruptions at the end
- Angel_DJYT
-
24 posts
Imported music can't loop without interruptions at the end
My browser / operating system: Android Linux 11 (also happens in an iPad or Moto 11), Chrome 105.0.0.0, No Flash version detected, Scratch version 3.0.
When I use a loop block like “repeat until” or “forever” the music I import to use in my space game (unshared) has an interruption at the end, and I even tried it on my other mobile device and nope.
When I use a loop block like “repeat until” or “forever” the music I import to use in my space game (unshared) has an interruption at the end, and I even tried it on my other mobile device and nope.
- D-ScratchNinja
-
1000+ posts
Imported music can't loop without interruptions at the end
This might solve your problem:
At the end of any loop, there's a short pause (yield) until the next frame (screen refresh), because that's how loops repeat 30 times per second (so animations run at 30 frames per second). That's enough to cause a sometimes-noticeable 1/30th-second long silence in looped sounds. If we stack the play-sound-until-done block multiple times, the blocks before the end of the loop don't pause for a 1/30th of a second like they would as a loop repeats.
I'm not the best explainer, but hopefully that helps you understand what's going on.
At the end of any loop, there's a short pause (yield) until the next frame (screen refresh), because that's how loops repeat 30 times per second (so animations run at 30 frames per second). That's enough to cause a sometimes-noticeable 1/30th-second long silence in looped sounds. If we stack the play-sound-until-done block multiple times, the blocks before the end of the loop don't pause for a 1/30th of a second like they would as a loop repeats.
I'm not the best explainer, but hopefully that helps you understand what's going on.
- Angel_DJYT
-
24 posts
Imported music can't loop without interruptions at the end
Thank you so much, fellow veteran Scratcher! Imma try it, also this topic is still not closed to help other newbies and get more creative suggestions.
- Angel_DJYT
-
24 posts
Imported music can't loop without interruptions at the end
And what if I want it to stop during gameplay when you press a button?
- D-ScratchNinja
-
1000+ posts
Imported music can't loop without interruptions at the end
The block below should work if you're using play-sound-until-done blocks. And what if I want it to stop during gameplay when you press a button?
Note that you'll need to use the stop-all-sounds block for sounds played by regular start-sound blocks.
- Angel_DJYT
-
24 posts
Imported music can't loop without interruptions at the end
Ok, thanks!
- Discussion Forums
- » Bugs and Glitches
-
» Imported music can't loop without interruptions at the end