Skip to main content
Skip to main content

Note the music

Integrating Digital
Technologies

Years 3-4; 5-6

DT+ The Arts: Music


We can program a computer to play music. Conventionally this is done by hard coding, which is the process of coding all possible expected behaviours. Alternatively, we can train an artificial intelligence (AI) computer about what notes go well with others, so it can play a duet with a human musician. Students can make their own instrument that plays a particular note for a set beat, for example when a piano key is pressed or a guitar string is strummed or a drum skin is hit. Alternatively, students can incorporate the random function to mimic AI.

This set of lesson ideas was developed in collaboration with the Digital Technologies Institute.



Decorative image

Image credit: theglassdesk/ pixabay


Preliminary notes

The image below shows a view of the AI based tool (application) used in the ‘Plugged’ section below: AI Duet. View the short video that explains this system (accessed by clicking on “how it works”) – it explains the AU used by the system in a simple and fun way.

Select the Play button to launch the AI app. At the bottom of the screen a row of virtual piano keys enables the user to play notes of the piano by using the mouse to select a key. Alternatively the user can select a letter on the keyboard to play notes. If using a tablet device the user can touch the virtual piano keys directly on screen.

The keys move from lower notes on the left to higher notes on the right.

When you play a note (touch a key), blue rectangles appear above the keyboard that represent the keys (notes) played by the user of the application.

The yellow rectangles (notes) are those played in response by the artificial intelligence.

Suggested steps

Unplugged activity

Music is linked to the Digital Technologies curriculum in many ways. You can teach the DT curriculum using music both unplugged and using computers such as this Google AI Duet. For example, music notation is all about codes—codes which tell the musician (or software program) what to do. Sound is a form of data that can be represented in different ways. Also, a song is a program, a list of instructions—for example, play a song and ask your students to identify iteration (loops) in it.

  1. Explore beat and representation of musical notation using Lego building bricks for example as described in this blog article. If you search on ‘Lego + musical notation’, you will find are several other articles. You may also want to show videos explaining beats (such as Learning Music for Kids). Here are some related questions for your students.
    1. Why is beat important in music?
    2. Can you represent quarter notes, half notes and a rest?
    3. How are musical notes used to represent sound?
  2. Provide students with a range of simple sequences of notes from familiar tunes, songs or rhythms. These may include celebration songs, nursery rhymes, culturally relevant examples and examples from pop culture. If possible, have students use a musical instrument with notes highlighted. Some questions for your students:
    1. How is the music represented? How does that help you play the music?
    2. How did you use listening to help you play the tunes and make sure it sounded correct?
    3. Do you think a musical score is like computer code? Why / why not?
    4. Can you order the notes in a scale C, D, E, F, G, A, B, C?

Plugged activity

In this activity we develop students’ programming skills using a musical context. Students will explore ways to program musical notes to create their own musical instrument to play, or play a duet between two instruments. To mimic AI, the program will apply a random change to the key and duration the musical notes are played. Finally, students compare their program to an AI tool that responds to a human, playing notes on a keyboard.

These activities use Scratch 3.0 and the additional ‘Music’ blocks.

This sequence of plugged activities has been ordered by least to most difficult and labeled in terms of ‘Levels’ (e.g. “Level One”, “Level Two”, etc.) as you may wish to use this terminology to students as they progress through each activity. Depending on the abilities of students, you may wish to start at a higher level.


The activity has been levelled to enable differentiation.



Discussion

Share what you have learned about AI and how ‘smart’ a computer can be. Compare the use of the random function used in the Visual Programming to mimic AI.

  • Could the program be improved to better mimic AI?

Why is this relevant

Algorithms and programming are essential to developing machines powered by artificial intelligence (AI). AI is the ability of machines to mimic human capabilities in a way that we would consider 'smart'.

In conventional programming the computer is provided with a set of instructions for a defined set of scenarios. In the music-making programs we have used above, the students hard coded the program with specific inputs to create an output. To mimic the AI we used the random function to come up with a random response to the first played instrument.

Machine learning (ML) is an application of AI. With machine learning, we give the machine lots of examples of data, demonstrating what we would like it to do so that it can figure out how to achieve a goal on its own. The machine learns and adapts its strategy to achieve this goal.

In the AI Duet example, the machine would have been fed enormous amounts of data on musical notes and rhythms. The AI has learned to respond to a sequence of notes that work in harmony with the input.

This lesson focuses on:

  • representation of music
  • the difference between explicit programming and learning by example as in AI.