Skip to Content

Action: Indigenous Role Models & Musical Knowledge

Activity 2: Indigenous Role Model Gallery Walk

We’re now going to explore a variety of Indigenous role models that are defying odds, fighting for racial justice, and so much more! 

The role model information is in the Resources section. Make it available to your students as a Gallery Walk by printing and posting them around the room.

Have students share their thoughts: 

  • Why is the person you studied considered an “entrepreneur”, “activist” or both?
  • What mindset(s) and belief(s) do you think or believe they have?
  • What did you find most interesting about this entrepreneur?
  • 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 grouped into groups of 4. Each group of 4 beats is called a measure (or note). Each beat is a quarter note in a piece of music. One measure has 4 quarter notes or 4 beats.

Change the Tempo! 

  1. Look at your Digital Audio Workstation. You will see that the top row measures time in seconds and the bottom row shows the measure markers. 
    How many seconds are in each measure on your DAW? The answer will depend on your tempo. If you set your tempo to 120 bpm, you should see 2 seconds for each measure.
  2. Try changing your tempo using the setTempo() function and see how the number of seconds changes for each measure. 
    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. OK! Change it back to setTempo(120)!

In EarSketch, every measure contains 4 steady beats. After you run a script in EarSketch, you can switch the metronome on or off to listen to the steady pulse of your song as it plays!

To learn more about Measures see Extensions B and C!

Activity 4: 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 these two examples of code or in this EarSketch Tutorial in the Curriculum: 27.6: Writing Custom Functions Both sets of code are correct, they have an ABAB form and will play the same song.

Example 1 (Without Custom Functions) 

#music

#Create a 4 measure verse section between measures 1 and 5 ←A

fitMedia(drum,1, 1, 5)

fitMedia(bass, 2, 1,5)

#Create a 4 measure chorus section between measures 5 and 9 ←B

fitMedia(vox,4,5,9)

fitMedia(clap1,5,5,9)

#Back to a 4 measure verse section between measures 9 and 13←A

fitMedia(drum,1, 9, 13)

fitMedia(bass, 2, 9,13)

#Back to a 4 measure chorus section between measures 13 and 17←B

fitMedia(vox,4,13,17)

fitMedia(clap1,5,13,17)

finish()

Example 2 (With Custom Functions)

#verse

def verse (start,end):

fitMedia(drum, 1, start, end)

fitMedia(bass, 2, start, end)

#chorus

def chorus (start,end):

fitMedia(vox, 4, start, end)

fitMedia(clap1, 5, start, end)

#Function Calls (setting up an ABAB musical form through function calls)

verse(1,5) A

chorus(5,9) B

verse(9,13) A

chorus(13,17) ←B

finish()

Which code is easier to read and follow? 

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

If you picked Example #2, you are correct! Code Example #1 (without custom functions) is much longer and more complex. (In fairness, the advantages are more obvious if the music is more complex! See a more complex example in 27.5: Introduction to Custom Functions)

Part of learning to be a programmer is learning how to write efficient and logical code.

What is a Custom Function?

Custom Function definition: 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.

Let's Run and Play that Code! 

  1. Open the 27.6: Writing Custom Functions EarSketch Tutorial 
  2. Scroll down until you see the sample code.
  3. Select the blue clipboard and then select the IMPORT TO EDIT button that appears on your CODE EDITOR.
  4. You will see a new script appear, and the code that two song sections are defined: verse and chorus.

    Alternately, create a new script for this activity! 
  5. Select the + sign at the top of your CODE EDITOR!
  6. Name it something like 'Custom Function Practice'. Copy and paste the following sample code into your code editor. 

    NOTE: It is best to do this from the EarSketch Tutorial because copying and pasting may not indent the fitMedia() functions properly!
  7. Select  RUN and PLAY
  8. You will hear that the verse section is playing from measure 1 to 5 and again from measure 9 to 13. 
  9. You should also hear that the chorus is played from measure 5 to 9 and measure 13 to 17. 
  10. If you look at the section in your code, #Function Calls, you will see that verse and chorus were called to play on these measures.

Note: In this example code, the chorus is the same each time it plays. We expect this. But, in a real song, the verse will likely not be the same. We might have verse1 and verse2

#python code
# script_name: Functions in YVIP
#author: EarSketch Team

from earsketch import *
init()
setTempo(120)

#Soundbank
drum=ENTREP_BEAT_DRUMBEAT
bass=ENTREP_THEME_BASS_1
vox=ENTREP_VOX_BK_FALSETTO
clap1=CIARA_SET_PERC_CLAP_3

#music
#verse1
def verse (start,end):
  fitMedia(drum,1, start, end)
  fitMedia(bass, 2, start,end)

#chorus
def chorus (start,end):
  fitMedia(vox,4,start,end)
  fitMedia(clap1,5,start,end)

#Function Calls
verse(1,5)
chorus(5,9)
verse(9,13)
chorus(13,17)

finish()

What's with the START and END Variables?

Functions in EarSketch need inputs or parameters (arguments). We use start and end to 'hold the place' for the measure to be used when we 'call' our function. That makes it so easy to change the timings as your creativity unfolds!

This custom function defines verse. It tells the computer to play a drum and a bass sound clip for a certain number of measures.

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.

Functions are an example of an abstraction because they bundle many small commands or actions to create a single task. An example of abstraction is combining smaller ideas or tasks to create a single, less complex concept.

Seymour Papert, the creator of the first programming language for students called these abstractions — mind-sized bites

Think about the simple concept of "brushing your teeth". Brushing your teeth is actually a series of actions such as putting toothpaste on the brush, wetting the toothbrush etc. However, when you tell someone to brush their teeth, you don’t include all those steps. The steps are understood as part of the "Brush your Teeth" command. This is an example of an abstraction — a mind-sized bite!

 Inside the definition of verse() are instructions, or the body of the function. These instructions are indented. In this example, we have selected sound clips and tracks and used fitMedia(), but will use our inputs start and end to note the timing of the sound clips. fitMedia() was used in the function body. (However, you can also include makeBeat(), loops, setEffect() and other functions/variables in the API. You can research that later!)

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.

For more on Coding Custom Functions with Staggered START and END measures, see Extension C.

It's okay if you are a little confused! Custom functions are the most complicated coding concept you've seen! You might want to start by just creating hard-coded functions for just your verse or just your chorus, and then if you get that working, challenge yourself to add the start and end, but know that the hard-coded option is acceptable for the competition. 

Activity 5: Coding Custom Functions in EarSketch (30 minutes + homework)

Now YOU are going to code your own custom functions like verse and chorus! For the competition submission, you will need to have at least one custom function in your code to define a section in your song.

This activity is similar to 27.7 Coding Custom Functions in EarSketch in the EarSketch curriculum.

Song Structure?

Ok. First of all, let's think about song structure!

Let's pretend it's the same as the example. Except, you may have an #intro from before. So we'll put that in! You will come back to that later.

Of course, you may 'kick it up a notch' later with bridges, transitions, outro, and so on. But, we'll start simply. 

So, this basically means that we can define functions for each of those song parts. Then all we need to type in our CODE EDITOR (along with start and end numbers—if not 'hard-coded) is:

#Function Calls

Intro()

Verse()

Chorus()

Verse()

Chorus()

Mind-sized bites those are!! :-) It's certainly easier to read than ALL the lines of code for each part! And, if we want to change something inside any one of those song parts, we can do that, but it won't change the function calls! That can remain the same.

Coding Custom Functions for your CHORUS

  1. Open Your Voice is Power [Your Initials] script (or select the open tab for that script).
  2. Decide on your message for the chorus of your song
    - It is important to have a clear and powerful message in the chorus. You may think about this more deeply later and just see this activity as a learning exercise.
  3. Gather together all your sound clips including your lyrics. For now, you might just quickly add existing clips for practice.
    - Add them to your #SOUNDBANK
    - Assign variables (nicknames) to them.
  4. Type #chorus in your code editor.
  5. Press Enter to make an empty line.
  6. Type def chorus(start,end): to define the function chorus with the inputs start and end. Be sure to include the colon :
  7. Press Enter. Your next line should indent. If not, press the tab key.
  8. Add your soundclips using fitMedia() functions on the lines below def chorus(start,end):
  9. Add in your fitMedia() measure parameters. 
    - Use start, end for the last two parameters. Example: fitMedia(drum,1, start, end)
    - Pay attention to your track numbers!
  10. Repeat this process with all of your tracks in your chorus. 
    - Make sure to indent all of your fitMedia() tracks.

    Note: (If there are fitMedia()functions that you don't want in the chorus either delete them or put a hashtag # in front of them so they won't play.)
  11. Press Enter to create a new line and delete the indent.
  12. Call your function as follows:
    - Type #Function Calls
    - Type chorus(5,9) and press enter, 
    - Type chorus(9,13) 

    We recommend calling each function and separating the start and end numbers with multiples of 4. This is assuming that you still have your #intro in measures 1 - 5! If not, adjust accordingly!
  13. Run your script. 
    - Did your "chorus" play twice? 
    - Does it sound the way you intended to code it? 
    - Does your code look similar to the example below?

#CHORUS

def chorus(start,end):

fitMedia(drums,6,start,end)

fitMedia(bass,7,start,end)

fitMedia(cymbal,8,start,end)

fitMedia(lyric,9,start,end)

#Function Calls

chorus(5,9)

chorus(9,13)

Now Define the Verse 

Repeat the instructions above (Coding Custom Functions for a CHORUS) to write a new custom function for VERSE

  1. Gather together all your soundclips. 
  2. Add them to your #SOUNDBANK
  3. Assign variables (nicknames) to them.
  4. Type #verse in your code editor
  5. Press Enter to make an empty line.
  6. Type def verse(start,end): to define the function verse with the inputs start and end. Be sure to include the colon :
  7. Press Enter. Your next line should indent. If not, press the tab key.
  8. Add your soundclips using fitMedia() functions on the lines below def verse(start,end):
  9. Add in your fitMedia() measure parameters. 
    - Use start, end for the last two parameters. Example: fitMedia(sfx,11, start, end)
    - Pay attention to your track numbers!
  10. Repeat this process with all of your tracks in your verse. 
    - Make sure to indent all of your fitMedia() tracks.

    Note: (If there are fitMedia()functions that you don't want in the verse either delete them or put a hashtag # in front of them so they won't play.)
  11. Press enter to create a new line and delete the indent.
  12. Important: Edit the chorus function call start and end times!
    - Change from chorus(5,9) to chorus(9,13)
    - Change from chorus(9,13) to chorus(17,21)
  13. Call your verse function. 
    - Type verse(5,9) and press enter, 
    - Type verse(13,17)
  14. You should have something like the following structure:
    verse(5,9)
    chorus(9,13)
    verse(13,17)
    chorus(17,21)
  15. Run your script. 
  16. Select Play!

This would result in Function Calls like the following:

intro()

verse(5,9)

chorus(9,13)

verse(13,17)

chorus(17,21)

Important Note: if you had the fitMedia() functions staggered, you will have to modify the parameters! See Extensions B and C!

Continue to add custom functions to lengthen your songs and add more variety. You can add a intro, outro, more verses, or a bridge to your song. Think about adding some transitions to your song between the verse and chorus. Transitions can be a one-measure sound clip using a fitMedia() function. It does not need to be included in a custom function. Check out the EarSketch Chapter on transitions. 6.3 Transition Strategies

Once you have defined your custom function, you should start to see the structure of a song emerge. When you listen to your code, you should recognize the sections of your song. Think about how the structure of your song also reflects the message or purpose of your song. See below for an example of how you can call your custom functions to organize your song structure.

Intro(1,5)

verse(5,9)

chorus(9,13)

transition1(13)

verse(14,18)

chorus(18,22)

transition1(22)

bridge(22,28)

verse(28,32)

Outro (32,36)

Congratulations, you have transformed your beats into a song. Your remix is almost complete.