Skip to Content

Action: Indigenous Role Models & Musical Knowledge

Activity 2: Indigenous Role Model Gallery Walk

Let's explore a variety of Indigenous role models that are defying odds, fighting for racial justice, and so much more in the Role Model Gallery

Break into groups and answer the following questions in your Student Writing Activity Workbook:

  1. Why is the person you studied considered an “entrepreneur”, “activist” or both?
  2. What mindset(s) and belief(s) do you think or believe they have?
  3. What did you find most interesting about this entrepreneur?
  4. If your entrepreneur had a theme song, what tempo music would you give them? Fast/Slow? Why?
Indigenous Knowledges

To create equity and change for Indigenous peoples in our communities, we all need to learn more about Indigenous peoples and the amazing work they are doing to invoke change.

Optional Extension D for a Sharing Circle.

Activity 3: Learn about Measures (10 minutes)

This activity is drawn from 26.6: Defining Measures in the EarSketch Curriculum

Often we talk about building the song in blocks of 4 and 8. Why? In music, beats are usually grouped into groups of 4. Each group of 4 beats is called a measure. Each beat is a quarter note in a piece of music.

In EarSketch, every measure contains 4 beats.

Continue with the code you had at the end of Module 4, or create a new script using the following code:

# description: 

from earsketch import *

setTempo(120)

# SOUNDBANK

#drums

drums = SAMIAN_PEUP_BEAT_FULL

#bass

bass = TFLAMES_OC_BASS_CHOR

#flute

flute = SAMIAN_PEUP_THEME_FLUTE

#strings

strings = SAMIAN_PEUP_THEME_STRINGS_3

#vocals

vocal1 = JWOLF_COTG_VOX_MISC_SHOUT

#intro

fitMedia(drums, 1,1,5)

fitMedia(bass,2,1,5)

fitMedia(flute,3,1,5)

fitMedia(strings,4,1,5)

fitMedia(vocal1,5,1,5)

Change the Tempo! 

  1. Run your code
  2. Look at the top of your Digital Audio Workstation. You will see that the top row measures time in seconds and the bottom row shows the measure markers. 

  1. How many seconds long is each measure? 
  2. The number of seconds per measure will depend on your tempo. A measure (in EarSketch) will always have 4 beats, but the time it takes to play those four beats will change depending on tempo.
  3. If your tempo is 120 beats per minute, and you have 4 beats per measure. There will be 30 measures per minute (120 beats per minute / 4 beats per measure).  If one minute has 30 measures, each measure will be 2 seconds long (60 seconds / 30 measures) .
  4. Change your tempo using the setTempo() function and see how the number of seconds changes for each measure. 
  5. Change the tempo back to setTempo(120) as we continue working on our song.

Activity 4: Staggered Start & End Measures

Related Video tutorials:

Don’t forget fitMedia() expects the following parameters

  • sound (the sound to play)
  • track (which track number to place the sound)
  • start (the measure at which the sound will start)
  • end (the measure at which the sound will end). 

  1. Run your code and Play your song from Activity 3. Notice how all the sounds play at the same time. This may sound great or it may sound terrible. We need the ability to start and stop sounds at different times in the song.
  2. If we change the start and end parameters we can get sounds to start and stop at different parts of the song.
  3. Pick one or more sounds to start at measure 1 and end at measure 3
  4. Pick one or more different sounds to start at measure 3 and end at measure 5
  5. Pick one or more sounds to start at measure 1 and end at measure 5
  6. Run your code, look at the DAW and you will see that the sounds now start and end at different places in the timeline
  7. Play the song, can you hear when one sound ends? Can you hear when another sound begins?
  8. Try to identify which sounds complement each other and sound good playing at the same time vs which sounds compete with each other and do not sound good playing at the same time. Play around with the start and end measures until you have a song intro that you like.
Staggered Stop and End Measures
Your finished code should look similar to the following:

# description: 

from earsketch import *

setTempo(120)

# SOUNDBANK

#drums

drums = SAMIAN_PEUP_BEAT_FULL

#bass

bass = TFLAMES_OC_BASS_CHOR

#flute

flute = SAMIAN_PEUP_THEME_FLUTE

#strings

strings = SAMIAN_PEUP_THEME_STRINGS_3

#vocals

vocal1 = JWOLF_COTG_VOX_MISC_SHOUT


#music

# add intro

fitMedia(drums, 1,1,5)

fitMedia(bass,2,1,5)

fitMedia(flute,3,1,3)

fitMedia(strings,4,1,3)

fitMedia(vocal1,5,3,5)

Activity 5: Introduction to Custom Functions (20 minutes) 

In an earlier module, we looked at SONG STRUCTURE with patterns such as ABAB. It’s time to transform your code into a song. How do you do this without writing lines and lines of code? Imagine you want to code a 2-minute song — you might end up with 150 lines of code! Woah, that is exhausting to think about!

We will use custom functions to define our song sections. This is a series of steps that are summarized in one command or function. Chorus or Verse will have a series of sound clips that it plays for an assigned time.

Watch this video on Song Structure to get a visual overview of the process.

Look at the two code examples below.

Both examples will play exactly the same song.

Example 1 (Without Custom Functions) 

# intro

fitMedia(drums,1,1,5)

fitMedia(bass,2,1,5)

fitMedia(flute,3,1,3)

fitMedia(strings,4,1,3)

fitMedia(vocal1,5,3,5)


# chorus

fitMedia(JWOLF_COTG_BEAT_FULL,6,5,9)

fitMedia(TFLAMES_OC_VOX_BKUP_CHOR_1,7,5,9)

Example 2 (With Custom Functions)

#Define intro function

def intro():

     fitMedia(drums,1,1,5)

     fitMedia(bass,2,1,5)

     fitMedia(flute,3,1,3)

     fitMedia(strings,4,1,3)

     fitMedia(vocal1,5,3,5)

# Define chorus function

def chorus():

    fitMedia(JWOLF_COTG_BEAT_FULL,6,5,9)

    fitMedia(TFLAMES_OC_VOX_BKUP_CHOR_1,7,5,9)

# music section

intro()

chorus()

Which code is easier to read and follow? 

Which code will be easier to edit if you want to make a change?

At first glance, the advantages of functions are not clear, but the more complex your code becomes the greater the advantages to using custom functions.

What is a Custom Function?

A custom function is written by the programmer to accomplish a specific task, often a task that must be done more than once. Functions take many smaller, repetitive tasks and assign them to a custom name.

You already used functions in EarSketch, such as fitMedia()—but now you will actually create your own functions. THAT is real programming! 

Custom functions are written by the programmer to accomplish a specific repeatable task with a single 'command' that executes multiple lines of code. 

Functions are named by the programmer, can have numerous inputs (parameters/arguments), and can be called anywhere in a script—assuming you have defined that function before you try to call it!

Functions not only make your code shorter, but it also allows you to create complex code that can be easily repeated without error.

Inside the definition of the function are instructions, or the body of the function. These instructions are indented. The function definition does not automatically execute the instructions in the function body. In order to use the function, we will “call” it. 

Calling a function tells the computer when to run it. Writing your custom function only tells the computer what clips to play on specific tracks, but not when to play to them. Calling your function tells the computer when to play the audio clips and for how long. You can also call that function anytime without rewriting all the code embedded in it.

Write your own custom function

Related Video tutorials:

Don’t forget fitMedia() expects the following parameters:

  • sound (the sound to play)
  • track (which track number to place the sound)
  • start (the measure at which the sound will start)
  • end (the measure at which the sound will end). 
  1. In your # SOUNDBANK add two new variables to hold an additional vocal and drum sound (you can use the sounds listed below or pick your own sounds.) We will use these new sounds to add a chorus to our song.

# SOUNDBANK

# Chorus sounds

drumchorus = JWOLF_COTG_BEAT_FULL

vocalchorus = TFLAMES_OC_VOX_BKUP_CHOR_1

  1. After your setTempo() command, add a comment to indicate you are creating a chorus function

# Chorus function

  1. On the next line use the def command to define a function with the name of chorus, don’t forget the colon after the function name.

def chorus():

  1. On the next line, indented, add your new sounds (or any other sounds you want in the chorus) to the chorus function using fitMedia(). 

NOTE: For python to know the sounds are part of the function, you MUST indent the fitMedia() commands! Whatever commands are indented are part of the function. As soon as Python sees a command that is not indented it knows that command is not part of the function. 

Use track numbers that don’t already have sounds playing. 

Specify start and end measures that will play the chorus AFTER the existing sounds in your song that make up the intro are finished playing. I’m adding my chorus after my intro is finished starting at measure 5 and ending at m

The finished function will look similar to the following:

# Define chorus function

def chorus():

    fitMedia(drumchorus,6,5,9)

    fitMedia(vocalchorus,7,5,9)

  1. Run your code. Look at tracks 6 and 7 measures 5 to 8. Why can’t you see the new chorus you just created? 

You can’t see the new sounds because defining a function does not execute the code inside the function. The code is executed when you call the function.

  1. Add a line of code after the fitMedia() statements that play your intro to call the function, don’t forget to add a comment to keep track of what the code is doing

# Add chorus

chorus()

  1. Run your code again and play the song to hear the chorus.
The finished code should look similar to the following

# description: 

from earsketch import *

setTempo(120)


# SOUNDBANK

#drums

drums = SAMIAN_PEUP_BEAT_FULL

#bass

bass = TFLAMES_OC_BASS_CHOR

#flute

flute = SAMIAN_PEUP_THEME_FLUTE

#strings

strings = SAMIAN_PEUP_THEME_STRINGS_3

#vocals

vocal1 = JWOLF_COTG_VOX_MISC_SHOUT

#Chorus sounds

drumchorus = JWOLF_COTG_BEAT_FULL

vocalchorus = TFLAMES_OC_VOX_BKUP_CHOR_1


# Define chorus function

def chorus():

    fitMedia(drumchorus,6,5,9)

    fitMedia(vocalchorus,7,5,9)


# music

# add intro

fitMedia(drums, 1,1,5)

fitMedia(bass,2,1,5)

fitMedia(flute,3,1,3)

fitMedia(strings,4,1,3)

fitMedia(vocal1,5,3,5)


# add chorus

chorus()

You can create functions for each section of your song, one to play the sounds for your intro, one to play the sounds for your first verse, one to play the chorus, and so on. This helps organize your code.

You can create an entire song without using any custom functions! But since Your Voice is Power is a coding and music competition, you are required to create a minimum of two custom functions if you want to enter the competition. So as you create your song, you may want to create functions  for each section of the song: Intro, Verse1, Chorus1, Verse2, Chorus2, Outro.

It's okay if you are a little confused! Custom functions are the most complicated coding concept you've seen! If you want a little more practice try following the instructions below to create another Custom Function for your intro()

BONUS CODING CHALLENGE: Create Custom Function for your intro

Can you figure out how to move the sounds from the introduction of your song into a function called intro() 

  1. Create another function called intro() 
  2. Move the fitMedia() commands for the sounds that play at the start of your song into the intro() function
  3. Call the intro() function in your #music section
  4. Run your code and play your song. Did it work?

DID YOU REMEMBER TO

  • Put the “:” after the function definition?
  • Indent the commands that are part of the function?
  • Call your function so the commands in the function execute?
  • Add comments so when anyone reads your code they understand it?

Breaking each section of my song into different functions makes it easier to follow the structure of the song and the structure of my code.

The completed code will look similar to the following:

# description: 

from earsketch import *

setTempo(120)

# SOUNDBANK

#drums

drums = SAMIAN_PEUP_BEAT_FULL

#bass

bass = TFLAMES_OC_BASS_CHOR

#flute

flute = SAMIAN_PEUP_THEME_FLUTE

#strings

strings = SAMIAN_PEUP_THEME_STRINGS_3

#vocals

vocal1 = JWOLF_COTG_VOX_MISC_SHOUT

#Chorus sounds

drumchorus = JWOLF_COTG_BEAT_FULL

vocalchorus = TFLAMES_OC_VOX_BKUP_CHOR_1

# Define chorus function

def chorus():

    fitMedia(drumchorus,6,5,9)

    fitMedia(vocalchorus,7,5,9)

# Define intro function

def intro():

    fitMedia(drums, 1,1,5)

    fitMedia(bass,2,1,5)

    fitMedia(flute,3,1,3)

    fitMedia(strings,4,1,3)

    fitMedia(vocal1,5,3,5)

#music

#add intro

intro()

# add chorus

chorus()

Songs need structure and Code needs structure

Though at first you may think adding functions make your code more complicated, as code gets more complex, functions add structure to your code and make it easier to understand.

You can continue to build your song by adding functions for each verse, for your outro, etc…


COMPETITION TIP: If you want to enter the Your Voice is Power competition your code needs to contain at least two custom functions.