# teaching machines

## Chords

This post is part of a series of notes and exercises for a summer camp on making musical instruments with Arduino and Pure Data.

There are several ways to map an instrument’s “inputs” to the pitch that it “outputs”:

• Many to one. For example, the trumpet has just three valves. One presses on some combination of these valves to produce a note.
• One to one. For example, each key on the piano plays a single note. The play multiple notes, you must press many keys.
• One to many. Can you think of an instrument where you press on a single input and you hear many pitches?

We’re about to make an instrument that’s a member of the one-to-many family. We’ll activate a single input and it will produce many outputs. Before we get to it, however, we need to be talk a bit about combining multiple notes at a time. For you see, not every combination of notes produces a pleasing sound.

### Scales

Musicians have cataloged many sequences or scales of notes that can be used to produce pleasing sounds. Scales start at a root note and jump up from the root in a particular pattern. Because the scale is defined in terms relative to the root, it is not an exact sequence of notes. Rather, it a relative sequence, built up from the root chosen by the musician.

### Major Scale

One of the most common scales in Western music is the major scale. A C major scale is rooted at C, an F♯ major scale is rooted at F♯, and so on. Let’s see how the major scale progresses using the MIDI number table we saw earlier.

octave C C♯ D E♭ E F F♯ G A♭ A B♭ B
0 21 22 23
1 24 25 26 27 28 29 30 31 32 33 34 35
2 36 37 38 39 40 41 42 43 44 45 46 47
3 48 49 50 51 52 53 54 55 56 57 58 59
4 60 61 62 63 64 65 66 67 68 69 70 71
5 72 73 74 75 76 77 78 79 80 81 82 83
6 84 85 86 87 88 89 90 91 92 93 94 95
7 96 97 98 99 100 101 102 103 104 105 106 107

The universal definition of the major scale goes like this:

root in octave i
+2
+2
+1
+2
+2
+2
+1

Using this table, answer the following questions:

• What are the MIDI numbers of the major scale starting at C in the fourth octave (C4)?
60
+2 = 62
+2 = 64
+1 = 65
+2 = 67
+2 = 69
+2 = 71
+1 = 72
• What are the MIDI numbers of the major scale starting at F♯3?
54
+2 = 56
+2 = 58
+1 = 59
+2 = 61
+2 = 63
+2 = 65
+1 = 66
• What’s interesting about the last note in the scale?
It’s the same as the root note but an octave higher.

When we start writing code, you will find it useful to know exactly how far from the root each note is. The third note, for example is +2 +2, or 4 half-steps from the root.

What are the distances from the root for each of the notes in the major scale?
0
2
4
5
7
9
11
12

Many other scales exist, but they only differ in their list of offsets. We’ll see others later.

Play any note in the major scale. Play the note two offsets beyond that note. Play the note two more offsets beyond. Play all three of those notes at the same time and you have a triadic chord, or a triad. It will sound pleasant.

Musicians name the triads that you can play using their starting note. If you pick the root, you are playing a I chord (read “one chord”). If you pick the second note, you are playing the ii chord (read “two chord”). Here’s the whole list:

I
ii
iii
IV
V
vi
vii

They are written in Roman numerals, but some are capitalized and some are not. The uppercase chords are called major chords, and the lowercase chords are called minor chords. Let’s figure out the offsets of these chords from the root. The I chord consists of:

• The root, which is 0 half-steps past the root
• The third note of the scale, which is 4 past the root
• The fifth note of the scale, which is 7 past the root

So, the I chord is comprised of offsets 0, 4, and 7. Let’s work through the offsets for the rest of the chords:

• What are the offsets for the ii chord?
2 5 9
• What are the offsets for the iii chord?
4 7 11
• What are the offsets for the IV chord?
5 9 12
• What are the offsets for the V chord?
This chord creeps up to the second note of the next octave, which is +2 past the root. The offsets are 7 11 14.
• What are the offsets for the vi chord?
9 12 16
• What are the offsets for the vii chord?
11 14 17
Based on the list, what do all the major chords have in common? The minor chords?
The major chords jump +4 +3. The minor chords jump +3 +4. Except for the vii chord, which jumps +3 +3. Musicians say that the vii chord is diminished.

Our instrument will play triadic chords in the major scale, so keep your list of offsets around. The qualitative differences between the two (or three) types of chords will be audible once it is built.