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.
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.
Having limited, low or no vision
Students with a vision impairment would benefit from adjustments to make the tasks accessible, for example students with:
Depending on the vision impairment, students may need to work with a sighted partner to play the musical instrument.
Deaf or hard of hearing
Students with a hearing impairment would benefit from adjustments to make the tasks accessible. Here are some examples.
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.
Explore an AI powered computer tool AI Duet to see how a computer responds to a sequence of notes you play on a keyboard.
Image: AI Duet
Discuss the ways in which the AI responded to your playing in AI Duet.
Students can learn basic piano songs such as Chopsticks by watching a video (such as this one here) and following along by:
Poor fine motor control
Students with limited fine motor skills would benefit from additional time to practice playing notes to compose a melody. It is recommended that they practice on musical instruments or touch-based devices so that they can get instant feedback (verses using a paper piano handout or a silent musical device).
Pencil code is an interactive website to create simple text-based code. Pencil code: Let’s jam is specifically designed to help to make music using code and includes sample melodies and songs which can be heard and modified.
Ask students how they could use a visual programming language such as Scratch to create music. Discuss and list the ideas. (It may help to display the Scratch programming environment for the class as you do this.) Some ideas may include:
You can also show them songs that have been made in Scratch. Scratch Noteblocks songs are songs made using scratch beats, not just scratch projects with MP3s added to them. Here is a list of popular Noteblocks songs. You could even turn it into a bit of a trivia game by playing a Noteblocks song and having students guess the name (e.g. Royals by Lorde) Consider having students choose a Noteblock song, and modifying it.
The code for this project has been provided for students to explore and remix.
This option requires some more programming skills. Create two sprites that play a sequence of notes, responding to each other’s playing. In this case, broadcast message is used to trigger a response for the sprite to play. Each sprite can be a different instrument.
Create just one sprite that plays a sequence of notes as shown in sprite playing Melody 1. Note the broadcast block will be used to start the Sprite created in Step 2. Remember to add a ‘Hide’ block otherwise sprite 1 will continue to show while Sprite 2 is playing.
Image: Screen capture of Scratch programming blocks, Melody 1.
Make a second sprite that plays the same melody as Sprite 1. This program will include the NoteChange and random block. The note change is applied to each note in the melody. The second sprite will start by including the ‘When I receive message’ block. The show button is used to show the sprite on screen.
To mimic AI, use a random number generator to generate a number between [–16, 16] so that each tone gets played lower or higher (–16 represents two octaves lower, 16 represents two octaves higher). You could use other values [–8, 8] or, even simpler, [–2, 2].
Create a variable called NoteChange. The variable NoteChange stores the random number. NoteChange is added to each note in the melody. Use the operator block to add the original note and the NoteChange variable; for example, the C note (60) played for 0.5 beats.
Image: Screen capture of Scratch programming blocks, response to Melody 1.
Students can view the code in the sample program and remix the project. In this code sample, the guitar player responds only once.
This will provide a further challenge. Some students may want to explore how to make the musicians respond to each other with changing tone and beat. To do this as shown here in Scratch Duet note and beat changes, they will need to create a variable for changing notes and changing beat. Add backdrops for each musician. The beat can be multiplied or divided by the random number. For example:
Image: Screen capture of Scratch programming blocks changing tone and beat.
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.
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: