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.
Arpeggiation
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.
Play this sample to hear two chords played followed by their equivalent arpeggiated versions.
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.
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!
Text editor powered by tinymce.