Sec 9-12 Scribbler Music

advertisement
Scribbler Music
Web Design
Notes
• Your robot can play music by “beeping” the
correct notes.
• Every note in music has a “frequency”
– Physics of Frequencies:
(http://www.phy.mtu.edu/~suits/notefreqs.html)
• Notes can be controlled by beeping the
correct frequency.
– beep(1, 440) -- Beep note A4
Scribbler Music
• Programming music by frequency is difficult!
• Scribbler has set of functions that help go
from notes to frequencies.
• Scribbler has a range of 8 octaves (same as a
piano)
• Scribbler has all the notes. They are denoted:
C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B
Scribbler music
• That is also the
default octave
which is the 5th
octave.
• You can create a
song in
python/scribble
r by simply
giving the note
and length of
the note:
e .25
d .25
c .25
d .25
e .25
e .25
e .25
d .25
d .25
d .25
e .25
g .25
g .25
e .25
d .25
c .25
d .25
e .25
e .25
e .25
e .25
d .25
d .25
e .25
d .25
c .25
Songs…
• Once you have the notes you need to add the
timing. Easiest is to default a whole note to 1
and the .5 for half note, etc.
• Now you create a song!
Playing a song
from myro import *
robot=Scribbler()
s=readSong("chariots of fire.txt")
robot.playSong(s)
Download