Music and sounds is an essential part of many of the best games, both on and outside of Scratch. But if you want to make your own music, you might want to record using some DAW (digital audio workstation) software and then upload it to Scratch. But what if you want to change the music based on what's happening in the game? Or want to allow users to edit music as well as the level in your latest level editor-equipped game? Introducing, the Music engine! What is a music engine? A music engine is an engine that allows you to play notes (using the Scratch music extension) in an easy-to-use and flexible way. You could just set up all of the note playing blocks on your own, but that could lead to code that's hard to navigate, or just problems with the music in general. This music engine uses a format for notes (I'm going to make a music editor) that is stored in a list, but with tweaking, you can make the music adapt to what's happening in your game to create an even more immersive experience. The built-in song is just a demo with one instrument, but the engine can also handle multiple instruments at the same time. The format is fairly simple: - Every instrument has it's own item in the two lists (instruments and MUSIC) - In the MUSIC list, every note is separated by a forward slash (/) - Every note that's played at the same time is separated by a pipe (|) - Notes that are held for a longer amount of time is prefixed with 'hn?', where 'n' is replaced with the hold time.
THIS IS VERY UNFINISHED AND BUGGY! This is not really intended for use in your own projects yet. I've shared this project in order to get feedback on how you think this could be improved. Feel free to poke around in the code and fix bugs. If you find or even fix any bugs, please report them to me so i can add them back here! (I'll credit you, of course!)