A great enhancement you can make to your game is to add some background music, a.k.a., BGM. We can pay homage to old school handheld gaming systems and use short, repeating arpeggio patterns for a charming motif that plays along to your gaming action.


An arpeggio is a sequence of notes, often short and played in ascending or descending order, that may be played in octaves or in the order of a chord. In fact, and arpeggio is sometimes referred to as a "broken chord". Playing multiple synthesized notes at once is called polyphony, and is sometimes taxing on the game hardware, so instead we can approach it with single notes (monophonic) played rapidly to convey the impression of polyphony.

Many early handhelds, such as the GameBoy, could play multiple synth voices at once, so weren't actually monophonic, but designers wanted to maximize their arrangements and use one track for drum sounds, another for leads, another for a bassline, and so on. So rather than eat up three sound channels for a chord, they could opt for arpeggios instead!

Play this sample to hear two chords played followed by their equivalent arpeggiated versions.

Only use the Google Chrome browser with MakeCode!

MakeCode Background Music

To create our BGM in MakeCode Arcade, we'll start with the play tone block, which allows us to select the a note and duration per tone.

Here, I've created a quick one octave arpeggio that adds some light, happy motion to the sound, compared to a single note.

Repeat this technique to create a repeating melody line. I chose a I-V-II-V note progression of C-G-E-G, while continuing the octave arpeggio technique.

Also, I found that I preferred the lower note of each octave pair to be shorter, so I changed the durations to 1/8th notes for those, with the higher octave notes at 1/4 notes.

I'd like to loop this phrase twice, so I'll place it in a repeat block. And then I'll move the phrase up a fourth, so we play F-C-A-C twice and then go back to the beginning.

Note that for the second phrase, I needed to multiply the frequency of the High C by two and enter 1046 Hz since the MakeCode Arcade graphical UI keyboard doesn't go up that high.

By placing the music into a Forever block, MakeCode Arcade will attempt to play the music throughout the games. However, some events, such as text prompts and Game Over events will block the BGM from playing, which works out just fine!

Check out this great upgraded version of Sparky Invaders in which Noe Ruiz added background music. You can download the .png file below and drag it into a MakeCode Arcade session to try it out!

This guide was first published on May 28, 2019. It was last updated on May 28, 2019.

This page (Background Music) was last updated on May 22, 2019.

Text editor powered by tinymce.