_gdev YouTube channel: https://www.youtube.com/@_gdev31
_gdev Cocrea: https://cocrea.world/@_gdev
What is Lazy Music?
With Lazy Music, you can save audio files in the cloud and load and play them when the program needs the audio file. The Lazy Music Extension can be used to save up some space for your project.
Why do you need Lazy Music?
Audio files are often the largest resource in a Scratch program file.
Scratch has a problem with audio uploading. Sometimes if it’s too big, it won’t allow you to save.
Gandi IDE's Lazy Music Extension introduces lazy loading technology into Scratch. You can upload audio files to the cloud server and load and play audio during the program's execution using blocks. This can avoid slow loading or errors caused by large project files.
What is lazy loading?
Lazy loading (also known as asynchronous loading) is a technique commonly used in computer programming and mostly in web design and web development to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program's operation if properly and appropriately used. This makes it ideal in use cases where network content is accessed and initialization times are to be kept at a minimum, such as in the case of web pages. For example, deferring loading of images on a web page until they are needed can make the initial display of the web page faster. From Wikipedia
How to use Lazy Music?
Let’s start with uploading music!
Click the ‘Upload Music’ button at the top of the extension blocks! It should look like this:
It will prompt you to select an audio file to upload. When you find your audio of choice, press upload. The button should turn into a bunch of dots. When it’s done, it will show you the following prompt:
It is the ID of the audio file you just uploaded.
Press CTRL + C (Command + C on MacOs) to copy the file ID. Then click ‘OK’.
Now, let’s start with loading our music into the project.
Find this block and drag it into the coding area.
Now select the current text in there, and press CTRL + V(Command + V on MacOs) .
Now that you have the file ID in the block, click it. It will load your music into the project.
Now you can drag out this block!
Copy and paste the same file ID in your load block, to the play block.
Now you can change the amount of seconds it skips into the song. If you just want it to play normally, leave it at 0.
Then you can choose to make it wait until done, or not wait until done.
Now just click the block and listen to your sweet jams.
You can drag this out:
This controls the speed of the song. The higher the percentage, the faster. And the lower the percentage, the slower it plays.
Once again make sure to copy and paste the file ID from your other blocks into this block as well. This can only change while it plays. So if you want it to be 75% when it starts, have the block be right after the play block. (Make sure the play block is at not wait until done)
And finally, we have the stop-play block.
This can be used to stop the current music from playing. Make sure it’s the right text, otherwise, it won’t stop the music. So make sure to copy and paste the correct text.
That’s all the blocks for the Lazy Music Extension. I hope you can start using this extension in your projects more often. It’s a real space saver.