Illustrating how the Kookaberry can play tunes from an indexed list and demonstrating the musical notation used on the Micro:Bit to write tunes.
Step 1: Setting up
Plug a Loudspeaker into P2
Step 2: Starting the App
Scroll down the menu to Music Demo and press Button B.
What is showing on the Home screen?
- Top Row: Name of app; Speaker (Spk) in P2 and Touch Sensor (Bt) in P1
- Second Row: Speaker in P2
- Third Row: The name of the selected tune
- Fourth Row: The number of the selected tune
- Fifth Row: Button A is Exit from app. Button C scrolls down the tunes menu. Button D scroll up the tunes menu. Button B plays the tune
Step 2: Running the app
- Select from list of very short 21 tunes by scrolling up (Button D) or down (Button C). When selected, play by pressing Button B
- To stop playing whilst in the middle of a tune, press reset (small button on rear of board)
- If reset is pushed the Kookaberry needs to be restarted and the Music Demo app selected again.
Micro:bit musical notation
Each note has a name (like C# or F), an octave (telling MicroPython how high or low the note should be played) and duration (how long it lasts through time). Octaves are indicated by a number ~ 0 is the lowest octave, 4 contains middle C and 8 is about as high as you’ll ever need unless you’re making music for dogs. Durations are also expressed as numbers. The higher the value of the duration the longer it will last. Such values are related to each other – for instance, a duration of 4 will last twice as long as a duration 2 (and so on). If you use the note name r then MicroPython will play a rest (i.e. silence) for the specified duration.
Viewing the micro:bit musical notation
- Connect the Kookaberry to a PC and open KookaIDE. Click on Load and find the lib folder in the connected Kookaberry
- Click and open the lib folder; select musictunes.py; and click Open. The file will now open in the right hand window of the KookaIDE
- The code in the right hand window is the microbit musical notation for all the tunes in the Music Demo library
- The first two instructions of the opening notes to Beethoven’s Fifth Symphony (DADADADUM) are:
- ‘r4:2’ which is rest in Octave 4 for 2 “ticks” duration
- ‘g’ is the note G in octave 4 (392 Hz) played for a 2 tick duration. The octave and duration states are carried over from the preceding instruction.
What are the main differences between the micro:bit and RTTL musical notations? Check out the latter in the RTTLMusicDemo App description