Lesson 4: Live loops

Building on Lesson 3, the children are introduced to live loops to create a repeating beat or rhythm

Before the lesson

Download classroom resources

Learning objective

  • To program a soundtrack

National curriculum

Pupils should be taught to:

  • Design, write and debug programs that accomplish specific goals
  • Use sequence, selection, and repetition in programs

Success criteria

Cross-curricular links

Attention grabber

Main event


Pupils needing extra support: Should continue with the coding commands from last time. No need to add live_loops or samples.


Pupils working at greater depth: Introduce them to the rrand(a, b) command, which chooses a random number between two parameters.

play rrand(60, 70)

Will pick a random note to play between 60 and 70. This means every time your code loops around, it will be a different note played.

sleep rrand(0.1, 1)

You can also use it for sleep duration.

Wrapping up

Assessing pupils' progress and understanding


Created by:
Sway Grantham,  
Computing specialist
Sway Grantham (@SwayGrantham) is a Primary School Teacher, a CAS Master Teacher and Specialist Leader in Education for Primary ICT. She also has a BCS Certificate in Computer Science Teaching (Primary). She has written several curricula and conducted research into the…
Find out more