Based on an activity from the Y3 NCCE Teach Computing Curriculum: see https://teachcomputing.org/curriculum/key-stage-2/programming-a-sequence-in-music.