ScratchData LogoScratchData
Back to __init__'s profile

Music player with Play/Pause and Seek

____init__•Created January 25, 2017
Music player with Play/Pause and Seek
32
22
294 views
View on Scratch

Description

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 Demo song: Vexento - Happiness Thanks to - @blob8108 for making kurt - @blob8108 (again) for helping me when it didn't work - whoever made pydub for making pydub (it's an awesome library)

Project Details

Project ID141703104
CreatedJanuary 25, 2017
Last ModifiedJanuary 25, 2017
SharedJanuary 25, 2017
Visibilityvisible
CommentsAllowed