Music player with Play/Pause and Seek
Drag the variable slider to seek. Press Pause to pause. Press Play to play.
So I made a music player with play/pause and seek functions, yay :D
The audio quality isn't the absolute best but whatever, this is Scratch. :P
Scratch does not have a built in way to pause/resume/seek or anything, so I wrote a small script using python, kurt and pydub to split the audio file into chunks of arbitrary size (for this example I used 500ms) and import them all into a big scratch project. If you're interested, you can find the script at https://github.com/TheInitializer/sb2-soundsplit
I originally tried 250ms but there was a noticeable delay in between the audio chunks due to Scratch's slowness so I increased to 500ms. More time means less delay (which shouldn't really be noticeable over 500ms) but more time for the pause button to respond after you click it. 500ms works well.
I then wrote a small script in scratch that basically loops through all the 400ish little sound files and plays them one at a time. If it's paused it just remembers where it left off (via the "index" variable) and resumes when you click Play.
Hope you enjoyed this! Sorry if it takes a while to load :P
Ready to Remix!
Add your ideas! You could try:
- drawing a new costume
- changing the scripts
- creating a new sprite