Play Note block doesn't always use current value of a numeric Note variable


In the Play Note block, you can put in a variable in the Note bubble, to specify the note to be played, with a number (the MIDI equivalent of the note)

For reference, the MIDI numbers are on the left, and the Play Note block has a range of 48 [C2] to 84 [C5]

What I did

Middle C has a MIDI number of 60. So if I want the Play Note block to play middle C, I could also

  • make a variable,
  • set it to 60,
  • and then put that variable into the Play Note block:

I wanted the object to play the notes E and G above middle C too. (64 and 67 are the MIDI numbers for middle E and G respectively)

What I expected to happen

I expected that the square would play C E G each time it is tapped.

What actually happened

The first time I tap the square, it plays C E. The subsequent times that I tap the square, it plays G C E.

Here is the link to the project. The code in the previous screenshot is in the square on the left.

A case where the code does execute as expected

On the square on the right, I added some Wait blocks after each time I had set the Note variable to a different value:

Then the project did play the notes in the order that I specified in the code (C E G), each time I tapped the square on the right.


I believe this has been an issue for a while now. Basically what seems to be happening is that the “blocksToExecuteNow” (same frame) are not executing in the order that they should be (when there are 2+ block types, ie start sound and set variable).

This means that set variable is happening after play note. If I recall correctly, the normal start sound block has this issue too, unless it has been fixed for that one.


Fixed with version 3.48.1.