/curriculum/activities/livecode-bad-bunny/
Learn to use lists in Python to create chords. Practice using chords together to make progressions.

Lesson Plan

Lists, Chords, and Bad Bunny

Learn to use lists in Python to create chords. Practice using chords together to make progressions.

Level

Beginner

Time

20-30 minutes
Try It

STEP 1: Create a new Project

  • Go to tunepad.com and sign in.
  • Create a new project and change the name to “Bad Bunny”.
  • Set the temp to 90 BPM (beats per minute)

STEP 2: Chords

  • Add a Keys cell to your project and set the instrument to Keyboard → Organ
  • This code uses four variables to hold the chords we want to play
  • Each chord is a list of note numbers
chord1 = [ 48, 52, 55, 59 ] chord2 = [ 52, 55, 60, 62 ] chord3 = [ 50, 55, 59 ] chord4 = [ 50, 53, 57, 59 ] / playNote(chord1, beats = 4) playNote(chord2, beats = 4) playNote(chord3, beats = 4) playNote(chord4, beats = 4)

STEP 3: Drums

  • Add a Drum cell to your project
  • Set the instrument to Drums → Headlines Drums
  • This code uses variables to play the drum sounds.
kick = 0 snare = 2 / playNote(kick, 0.75) playNote(snare, beats = 0.25) playNote(kick, beats = 0.5) playNote(snare, beats = 0.5) playNote(kick, beats = 0.75) playNote(snare, beats = 0.25) playNote(kick, beats = 0.5) playNote(snare, beats = 0.5)

STEP 4: Hi-Hats (optional)

The last step adds hi-hats using a loop in Python. Feel free to try this code out if you want to.

Add a new Drum cell to your project and set the instrument to Drums → Headlines Drums

hat = 5 / for i in range(14): playNote(hat, beats = 0.25) / for i in range(4): playNote(hat, beats = 0.25 / 2)

IMPORTANT

  • Some of this code is indented by four spaces
  • We use indented code to tell Python what to repeat inside a loop
  • Use exactly 4 spaces so that Python doesn’t get confused

Try It

Open this project in TunePad https://tunepad.com/project/43861