How do I get Makecode to play multiple music notes at a time?

I’ve been trying to figure out how to get Makecode to play multiple music notes at a time. I know how to put in the play melody block, and then go into Javascript to make longer songs with multiple pitches of notes, but how do I get Makecode to play two (or three) different notes at the same time?

For example, if I write a bass line for the melody and something higher to play over it, Makecode will just play one one group of coded notes and then play the next set of notes when it’s over. How do I get them to play at the same time?

If you import the timers extension you can play multiple notes with the separately do block:
image
image
Note that you can only play 5 notes at a time

3 Likes

Thanks! I appreciate the tips!

1 Like

There’s also this chords extension:

Copy that into the extension bar like so… then press enter… then click on the extension block that appears to install it into your game.

1 Like

Thanks! I’ll check it out!

One way to do multiple notes at once without an extension is to have a “On game update every _ ms” block that increments a variable each time it happens. This variable can be used in a forever loop as "if (variable) = (value) " then it can run code at that time with two of these if statements.

(So you need 2 forever loops I’m guessing?)

Yes, the variable is used so that you can have them both in separate forever loops but have them go at the same time.

2 Likes