Step 1: Make it
What is it?
Improve your micro:bit guitar by shifting the pitch up and down octaves.
How it works
- Connect your micro:bit to headphones or a speaker so you can hear sound.
- Connect metal foil pads to the micro:bit's pins like in the Guitar 1 and Guitar 2 projects.
- Instead of using musical notation to play notes, this program stores the frequency of each note in variables called F, A, C and E.
- When you touch pin 1 or pin 2 and GND it will play a broken chord, but now you can move the chord down an octave (lowering its pitch) by pressing button A, and move it up an octave (raising its pitch) by pressing button B.
- The pitch (frequency) of a note doubles when you move up one octave: middle A has a frequency of 440Hz (440 vibrations per second), high A has a frequency of 880Hz. This is why making the vibrating part of guitar strings different lengths with your fingers changes the pitch of the note being played.
- Buttons A and B halve and double the frequency number stored in each variable, which has the effect of lowering or raising each note played by one octave.
What you need
- micro:bit and optional battery pack
- headphones, buzzer or powered speaker
- 5 crocodile clip leads
- optional cardboard, tin foil, glue stick, scissors to make guitar or keyboard
Step 2: Code it
Step 3: Improve it
- Make a guitar-shape cardboard cut-out and mount your micro:bit to it so you can perform standing up.
- If you shift the octaves too high or too low the program will stop working – and you can’t hear very low or very high frequency sounds. Modify the program to stop this happening.
- Increase or decrease the tempo depending on which way you tilt the micro:bit.