Theses should be pointed out and emphasized to the students.
Example:
from earsketch import *Examples:
fitMedia(clip name, track number, starting measure, ending measure)init()setTempo(140)Using the makeBeat() function is a perfect way to require the use of loops in a student project. In order for beats to repeat you must use a for loop.
for i in range(1,17): makeBeat(OS_KICK06, 1, i, "0++-0++-0++-0++-") makeBeat(OS_SNARE01, 2, i, "----0++-----0+00") makeBeat(OS_CLOSEDHAT04, 3, i, "000-000-000-0-00") makeBeat(OS_OPENHAT04, 3, i, "-----------0----")The best way to start using variables is to create a list of variables for the sounds you want to use. This will simplify the names of the sounds when you want to use them.
Example:
#Sound LibraryKick = "YG_EDM_KICK_1"Snare = "RD_EDM_DRUMBEATPART_2"Hat = "RD_EDM_DRUMBEATPART_4"Loop1 = "RD_EDM_DRUMBEATPART_8"Bass = "DUBSTEP_BASS_WOBBLE_013"DrFill = "RD_EDM_DRUMROLL_BREAK_6"Crash = "RD_EDM_DRUMBEATPART_1"Lead = "RD_EDM_HIT_LEAD_1"Synth1 = "YG_EDM_SYNTH_2"fitMedia(Kick, 1, 1, 32)fitMedia(Snare, 2, 1, 32)fitMedia(Hat, 3, 1, 32)fitMedia(Loop1, 4, 1, 32)fitMedia(Bass, 5, 5, 8)fitMedia(Bass, 5, 9, 16)fitMedia(Bass, 5, 17, 24)fitMedia(Bass, 5, 25, 33)fitMedia(DrFill, 6, 15, 17)fitMedia(DrFill, 6, 23, 25)fitMedia(DrFill, 6, 31, 33)fitMedia(Crash, 7, 33, 34)setEffect(5, VOLUME, GAIN, -20)fitMedia(Lead, 8, 9, 17)fitMedia(Synth1, 9, 17, 25)fitMedia(Lead, 8, 25, 32)A conditional (IF statement can be used to modify a drum beat within a loop. In this case we are creating a fill. We use the modulas operator "%" to get the remainder of the division. This means that a drum fill will be played every 4 beats.
for i in range(1,33): if i % 4 == 0: makeBeat(OS_KICK06, 1, i, "0++-0++-0++-0000") makeBeat(OS_SNARE01, 2, i, "00-00+00--00----") makeBeat(OS_CLOSEDHAT04, 3, i, "000-000-000-0-00") else: makeBeat(OS_KICK06, 1, i, "0++-0++-0++-0++-") makeBeat(OS_SNARE01, 2, i, "----0++-----0+00") makeBeat(OS_CLOSEDHAT04, 3, i, "000-000-000-0-00") makeBeat(OS_OPENHAT04, 3, i, "-----------0----")