Start by creating a new project. Give it a name like 'Music Maker'.
Now it's time to add some music! We'll use the 'music.play' function. This function plays a melody when you press a button. Here's the code:
input.onButtonPressed(Button.A, function () { music.play(music.stringPlayable("- - - - - - - - ", 120), music.PlaybackMode.UntilDone) })
You can replace the '- - - - - - - - ' with a melody from the gallery or design your own melody using the tool. The '120' is the tempo of the music, you can change it to make the music faster or slower.
Now you can test your music! Press the 'A' button on the simulator to hear your melody. If you have a physical Microbit, this step is optional, you can download the code onto your device and press the 'A' button to hear the music.