IDT‎ > ‎Assignments‎ > ‎

Week of Jan. 31

posted Feb 1, 2017, 4:41 AM by Michael Reilly   [ updated Feb 3, 2017, 2:35 AM ]

Know how to use fitMedia, makeBeat, strings and for loops!  By Friday, you should have a song that includes a minimum of 4 tracks:  percussion, bass, and two leads (like guitar or piano).  Your song should have about 12 to 20 measures.

You need to use fitMedia, makeBeat, and a loop.  (See how to use a loop and makeBeat below).

If you do all of that, you get a 90.  If you do one more thing that was not covered in class, you can get a 100!  (The last 10 points is a reward for "learning how to learn", the most important thing you can do in technology.)

fitMedia(sound, track, startingMeasure, stopMeasure)

A string is stuff surrounded by quotes.  A beat string is a combination of 0, + and -
0 starts a sound
+ continues a sound
- is no sound

Here's an example:  beats="0+++0+++0+--0+--"

makeBeat(sound, track, measure, beatstring)

Finally, a "for loop" in Python repeats according to what you want, and gives you a variable for a number, like a measure.

for m in range(1, 20)    is the Python that gives you a loop that repeats 20 times, and puts the numbers 1 thru 20 in the variable m

for m in range(1, 20):
    makeBeat(DRUMS, 2, m, beats)

Here's a whole sample:

from earsketch import *
beat = "0-00-00-0+++0+0+"
# using iteration instead of repeating similar lines of code
for measure in range(1, 9):
    makeBeat(drum, 1, measure, beat)