-
Notifications
You must be signed in to change notification settings - Fork 0
/
lessons.html
executable file
·237 lines (222 loc) · 8.23 KB
/
lessons.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<html>
<head>
<style>
body { margin-left:200; margin-right:200; }
</style>
</head>
<body bgcolor="#AAAA88">
<h1>GHC Piano: Lesson Plans</h1>
<h2>The Binary Code</h2>
<h3>Counting</h3>
<p>
How do you count when you only have the two digits 0 and 1?
<p>
<pre>
0 zero
1 one
10 two
11 three
100 four
101 five
110 six
111 seven
</pre>
<p>
<h3>Encoding</h3>
How many bits do you need to order an ice cream cone?
<p>
Suppose that there are three sizes of ice cream cone: small, medium, and large.
And suppose that there are five flavors: vanilla, chocolate, strawberry,
mint chocolate chip, and orange sherbet.
<p>
With one bit we can only have two choices, 0 and 1.
With two bits, we can count to up three, so that would
be enough bits for us to pick one of the three cone sizes.
So, we need three bits to pick the ice cream cone size.
Let's use 0 (zero) for small, 1 (one) for medium, 10 (two)
for large and (what the heck), let's just say that 11 (three)
means that we don't want any ice cream at all -- after all that
is a choice (What! You don't like ice cream?) well, of course
I like ice cream, I'm just trying to show that maybe there were
four choices after all (But everyone likes ice cream!) I know,
that's not the point...
<p>
Notice that although we have these four (You mean three. Everyone
likes ice cream.) All right parenthesis, that's it, no more asides!
Although we have these four choices, we aren't using the number four(4).
That is because Computer Scientists like to start counting at zero
rather than one. Our four choices are zero (00), one (01), two (10),
and three (11). (Maybe we should let zero (00) mean that we
don't want any ice cream -- that kind of makes sense. If we ever
wanted to compare the values we could say:
<pre>
<b><i>
Zero ice cream is less ice cream than a small ice cream cone
and
a small ice cream cone is less ice cream than a medium cone
and
a medium cone is less than a large cone.
</i></b>
Or: zero is less than one which is less than two which is less than three.
<b> 0 < 1 < 2 < 3</b>
But we are using binary numbers now, so this is:
<b> 0 < 1 < 10 < 11</b>
</pre>
<p>
So we can have four different choices with two bits, but we
need at least five to select the ice cream flavor. So let's
add another bit. With three bits we can count:
<pre>
0 zero
1 one
10 two
11 three
100 four
101 five
110 six
111 seven
</pre>
<p>
We are able to count from zero to seven with three bits, so
that is eight different binary codes. Remember, if you start
counting with zero and count up to seven, you get
[0,1,2,3,4,5,6,7] which is eight different numbers.
Computer Scientists have very good reasons for counting this
way, really. They're not just doing it to confuse other people.
Zero can be very important number.
<p>
So our Binary Encoding of the five ice-cream flavors could be:
<pre>
0 zero vanilla
1 one chocolate
10 two strawberry
11 three mint chocolate chip
100 four orange
</pre>
<p>
In the old days, Baskin Robbins boasted that they had 31 flavors
(which they did just to annoy Howard Johnson, who had become
famous by offering 28 different flavors).
So, how many bits would they have needed?
And how many bits did Howard Johnson need?
<p>
<b>Bonus Question:</b>
Who started putting the bits directly into the ice cream?
<p>
Now unlike the cone sizes, it doesn't really make sense
to talk about which flavor is larger or smaller than another.
Personally, I always think of chocolate as having more
flavor than vanilla, but is mint greater than or less than
orange? You would never get people to agree on a flavor
ordering because they'd be trying to say that their
favorite flavors are greater than the others.
<p>
But this isn't really important. Although we created
the binary code by counting in binary, when we use
a binary encoding to represent a choice, we aren't
using them as numbers but as <b>symbols</b>.
We just need to be able to tell them apart and know
what they stand for (0 stands for vanilla, 100 stands
for orange sherbet).
<h3>What Have we Learned?</h3>
<p>
There is a T-shirt that says:
<center>
<b><i>
<pre>
There are 10 kinds of people in the world.
Those who understand the binary code and those who don't.
<pre>
</i></b>
</center>
That 10 sure looks like it could be the number ten, but
now that you are one of the people that understands
the binary code, you can get the joke and realize
that the T-shirt really says:
<pre>
<center>
"There are two kinds of people in the world.
Those who understand the binary code and those who don't."
</center>
</pre>
<p>
Every one else will still be scratching their heads over
what they <i>think</i> says: "There are ten kinds of people..."
<h3>Binary Encoding</h3>
How is this used in the Piano Roll Reader?
<p>
We want the piano to be able to play lots of different
scales. Major, minor, harmonic minor, melodic minor,
pentatonic, etc. So if we interpret the first three
spaces as a binary code we can tell the Piano which
scale to use by setting it down over a particular
pattern of black and white squares.
<p>
When you first turn the Piano on (or when you press
the <b><i>Reset</i></b> button). The first thing it does
is look at the 12 spaces under the reader to see
which spaces are black or white.
<p>
If the white areas represent 0 and the black ones 1...
<center>
<img src="initialize.png" width=600>
</center>
<p>
That pattern to the far left is telling the Piano that
we want to use the Harmonic Minor Scale (choice 010),
A slow attack (1) and fast decay (0), Tremolo (1), but
no Vibrato (0), and we want the waveform to be a Sine wave (00).
We haven't decided how to use the last three bits (111).
<h1>Answers:</h1>
<h2>Answers to Binary Encoding Questions</h2>
<ol>
<li>5 bits for Baskin Robbin's 31 flavors</li>
<li>5 bits for Howard Johnson's 28 flavors</li>
<li>Steve Harrell of "Steve's Ice Cream" in Boston invented the <em>mix-in</em> in 1973. <b>Mix-in</b><sup>™</sup> was actually a Trademark he sold along with his store in 1977.
</li>
</ol>
<h2>Melody and Harmony</h2>
<h3>Notes and Melody</h3>
<h3>Chords and Harmony</h3>
When we play more than one note at the same time and they sound
particluarly good together, we sometimes refer to it as a "chord".
Often, we have chords changing slowly in the background when
we hear a melody. Folk songs and Rock and Roll typically have
this form.
But suppose we tried to create a different chord for each note in
the melody -- the way some jazz is composed. Or maybe we could
take just a single note from each of those possible chords and
play that note along with the melody. If we pick the notes well,
we will still hear the melody distinctly, but it will be filled
out with a rich texture from this other set of notes -- which
are called <b><i>the harmony</i></b>.
Harmony is like a alternate melody, but one which forms interesting
chord-like patterns when played alongside its melody. The melody
should still stay formost in our attention -- but the notes of the
harmony give it a much richer feeling and the chord patterns can
create excitement, sorrow, or tension by using minor and diminished
chord intervals and also finality and resolution with major chord
intervals.
<h3>The Crab Canon</h3>
<p>
Bach wrote an interesting piece of music for
two violins called the Crab Canon.
When the sheet music for this piece is placed between
two violinists so that one is looking at the page right-side
up and the other is looking at it upside-down. They each see
their own part of the Crab Canon, which is the other player's
part backwards.
<center>
<img src="crabcanon.png" width=500>
</center>
<p>
Because of the limited range of the GHC Piano, we can't
perform the entire Crab Canon as Bach wrote it. Can we write
a shorter piece of music based upon the same idea?
<p>
If you create our mini-Crab Canon on the Piano roll panel,
you can simply flip it over to play the reverse.
<p>
Which direction is the melody and which is the harmony?
</body>
</html>