Tag Archives: music

Teaching variables using Sonic Pi in primary classroom coding

Variables are very powerful. They are used in Scratch and can easily be taught through drama.

VARIABLE Life = 5

VARIABLE Points = 0

VARIABLE Game Over = false

IF you get touched, you lose a life

IF you score, you get 1 point

FOREVER (if GAME OVER NOT TRUE) CHECK LIFE & POINTS

IF LIFE = 0, GAME OVER = TRUE, WIN = FALSE

IF POINTS = 10, GAME OVER = TRUE,WIN = TRUE

IF GAME OVER = TRUE, CHECK WIN.

This demonstrates how variables can be used in music using Sonic Pi.

The power of variables – making music easy in KS2 coding

Variables are really useful – as the name suggests, they can vary. When you make a simple change in the variable, the result can feed through a program rather than you having to type it in everywhere.

So for music, we have developed a function. In functions, you can “send” details to a function and it will carry it out for you. It saves you having to keep typing the function again and again.

Continue reading

Coding music in a primary school with Arduino

A noisy lesson – take a couple of speakers and get them to play a frequency. The frequency range is about 30 hertz to 20,000 hertz. As you get older, the top level you can hear goes down. I like this lesson as it teaches some key words such as frequency, tone, pitch and vibration. It also builds up into teaching the idea of variables as well as functions. Plus it teaches music.

The basic code for Arduino:

tone (10,500);  // 10 is the speaker pin, 500 is the frequency.

Easy to pick up. Here’s an example.

It’s just tones at the moment. We can use this to make music as well.

Latest school project – coding an all flashing, all singing card

The aim is simple:

  1. Make basic circuit so LEDs flash up. (they can code LEDs to flash already in Arduino)
  2. Learn how to create a tune using the TONE function.
  3. Link the tune to flashing lights.
  4. Create the circuit on a piece of card
  5. Put the circuit on to a small chip so it works independently. (my job)
  6. Take home, add power and watch it light up.

It’s going to be a fun, creative project. They can even paint the card as well so it looks all pretty and artistic.

The only real cost is the chip – and that’s £2!! The speakers will be hacked from broken headphones – something that’s very common in primary schools. I like this because it shows that broken does not mean broken.

The project will also teach the physics of sound – looking at frequency and pitch. Plus coding of course.

This is the prototype.