The Music extension lets you compose music and play notes in your game, using real instruments. This extension is not available by default. To learn how to add it to your game, see Game Builder Blocks - Extensions.
The Music Tab
Tempo (BPM): how fast the music plays, in beats per minute. The default is 120, and it can be set from 40 to 500.
Add New: adds an instrument to the game. You can choose piano, guitar, electric guitar, flute, trumpet, violin or organ.
You can add more than one instrument. Each instrument appears in the dropdown of the music blocks, so any sprite can play it. Like sprites, instruments can also have their own code.
How Notes Are Played
Each instrument plays its notes one after the other. When a sprite plays a note, the code after the Play Note block waits until the note ends, so a stack of Play Note blocks plays as a tune. Different instruments play at the same time, so you can play a melody on one instrument and chords on another.
Music Blocks
Block | Description |
Play Note (note) on (instrument) for (beats) | Plays one note on the instrument chosen in the dropdown, for the number of beats you set. A note is a letter and a number, like C4. The letter is the note (A to G, add # for a sharp), and the number is the octave: the higher the number, the higher the note. |
Play Notes on (instrument) for (beats) | Plays all the Note blocks inside it together, as a chord, for the number of beats you set. |
Note | A single note, used inside the Play Notes on block. Add several Note blocks to play a chord. |
Rest (instrument) for (beats) | Makes the instrument wait (play nothing) for the number of beats you set, before its next note. |
Set volume of (instrument) to (percent) | Sets the instrument's volume, from 0 (silent) to 100. The new volume is used from the next note. |
Music Presets
The Music Presets group has ready-made tunes, like Twinkle Twinkle Little Star, Ode to Joy, Jingle Bells and Für Elise, and a set of chords. Click a tune to add its blocks under the On Run block. If you are editing an instrument's code, the tune plays on that instrument. Otherwise it plays on the first instrument in the dropdown. You can change the notes and the instrument to make the tune your own.
Example
To play a short tune when the player clicks a sprite, add an On Click block to the sprite. Inside it, add three Play Note blocks with the notes C4, E4 and G4, and choose your instrument in each dropdown.
Relevant Articles:






