scratch-vm icon indicating copy to clipboard operation
scratch-vm copied to clipboard

Option Remove delay after "play sound () until done" allowing songs to loop seamlessly

Open H-A-M-G-E-R opened this issue 1 year ago • 5 comments

when flag clicked play sound (start) until done forever { play sound (loop) until done }

should be no delay between start and loop or loop and loop with this option enabled without any custom extensions that make it unloadable on vanilla scratch

H-A-M-G-E-R avatar Dec 17 '24 06:12 H-A-M-G-E-R

the thing is also that scripts running are always aligned to frame increments, and that can't really be fixed.

CST1229 avatar Dec 17 '24 14:12 CST1229

So I think seamless looping be added to the compiler (remove any frame delays), it's impossible using scratch's interpreter I know that the MP3 format has a limitation that a tiny delay is added, so I use .ogg disguised as .mp3 to remove the tiny delay before the sound. Even if the script is run in a no-screen-refresh custom block it's still not seamless

H-A-M-G-E-R avatar Dec 17 '24 19:12 H-A-M-G-E-R

we seriously need a way to remove delay.

Drago-Cuven avatar Jan 05 '25 22:01 Drago-Cuven

There are some tricks you can do that will even work in normal Scratch, like instead of using play until done, use start sound then a wait block thats slightly shorter than the sound's length.

GarboMuffin avatar Jan 05 '25 23:01 GarboMuffin

I think the wait block is rounded to the nearest 1/30th of a second so it's impossible to loop a song where the loop's duration isn't a multiple of 1/30.

H-A-M-G-E-R avatar Jan 07 '25 22:01 H-A-M-G-E-R