cools maths gamesSurprise me

Block Code Music

Program a familiar French round with note blocks, then use functions and rests to layer it into several voices.

Block Code Music title screen
  • Partly works on mobile
Report a problem

Turn your phone sideways for a bigger view of this game.

Block Code Music turns a program into a song. Each block sounds a note rather than moving a hero, and the target melody sits on a staff to the left. The goal is to match each tune and learn to use functions so a phrase is written once and played many times.

How Block Code Music Works

Every program hangs from a starter block labeled when Run clicked. Place play note blocks under it, pick a pitch and a length for each, then hit Run Program. Your notes appear in black over the gray target notes. Match the target and the game shows the JavaScript your blocks made.

From level 2 on, you are asked to reuse phrases with functions. If you repeat note blocks instead, the game reminds you that your solution could be better.

Later levels add a set-instrument block and a rest block. The last target levels run several starter blocks together, each delayed with rests, so the voices stack into a round.

Your First Few Minutes

  1. Look at the gray notes on the staff to see the target.
  2. Drag four play note blocks under the start block.
  3. Set each pitch to match the staff, then press Run Program.
  4. On the next level, move those notes into a function block.
  5. Call the function twice and run it again.

Controls for Block Code Music

Keyboard, mouse and touch controls for Block Code Music
To do thisKeyboardMouseTouch screen
Add note, rest or function blocksnot usedClick the Music category and drag a block into the workspaceTap the category and drag a block
Choose a pitchType a note name such as D4 and press EnterClick the note name and pick a line on the small staffTap the note name and pick a line
Choose a note lengthnot usedClick the note symbol on the blockTap the note symbol
Play or stop your tunenot usedClick Run Program, then ResetTap Run Program, then Reset
Change playback speednot usedDrag the tempo sliderSlide the tempo control

What It Trains

You practice a key coding idea: write a piece once, give it a name and reuse it. A tune with repeated phrases becomes a short, readable program.

Careful listening matters too. You compare what you hear and see on the staff with the target, then track down the one pitch or length that is off.

Strategy Notes

  • Name each phrase. Clear labels for each section keep a long song tidy.
  • Let the staff guide you. Gray notes show exactly what is still missing.
  • Fix lengths, not counts. A phrase that finishes on a held note needs a longer length, not an extra block.
  • Use rests for the round. Rests make each new voice enter after the last.
  • Pick different sounds. Separate instruments make each voice easy to hear.

Good to Know

The music stays silent until you run your program, and Reset cuts it off instantly. Eight sampled instruments are included, among them piano, banjo, trumpet and violin. Blocks work with mouse or touch, and a larger screen gives the staff and workspace more room.

Block Code Music questions and answers

What song do I build?

The target levels all use Frère Jacques. The opening notes are C4, D4, E4 and C4, and the final target has four voices playing it as a round.

What is a function in this game?

It is a named group of note blocks. You build a phrase once inside a function and then call it as many times as needed. Level 2 asks you to play four notes twice without adding more note blocks.

Is there a free play level?

Yes. Level 10 has no target tune, so you can compose anything you like with the blocks you have learned.

Can I slow the music down?

Yes. A tempo slider lets you play your program slower, which makes it easier to hear where a wrong note sits.

Games that use coding like Block Code Music

Different rules, same kind of thinking.

Try something from another shelf