# python code
# script_name:Song of Summer
#
# author:Jonathan Hajzus
# description:Listener chooses 1 of 3 songs to listen to
from earsketch import *
from random import *
init()
setTempo(120)
genre = readInput("Pick a genre: Hiphop, RNB, or Rock.")
#hiphop
if genre == ("Hiphop"):
measure = []
fitMedia(CIARA_SET_THEME_ATMOS_2, 1, 1, 5)
fitMedia(CIARA_SET_THEME_ATMOS_2, 1, 7, 11)
fitMedia(CIARA_SET_DRUMBEAT_5, 3, 7, 11)
fitMedia(CIARA_SET_BASSLINE_2, 2, 7, 11)
setEffect(1, VOLUME, GAIN, 0, 4, -60, 6)
setEffect(1, VOLUME, GAIN, -60, 6, 0, 7)
fillDrum = CIARA_SET_DRUMBEAT_5
beat = "0+++0+++0-000+00"
index = randint(1,5)
if measure in range (1, 7, 1):
for index in range (index):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(7, 11)
fitMedia(CIARA_SET_THEME_ATMOS_2, 1, 10, 16)
fitMedia(CIARA_SET_THEME_ATMOS_2, 1, 18, 22)
fitMedia(CIARA_SET_DRUMBEAT_5, 3, 18, 22)
fitMedia(CIARA_SET_BASSLINE_2, 2, 18, 22)
for measure in range(11, 18, 1):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(17, 22)
fitMedia(CIARA_SET_THEME_ATMOS_2, 1, 23, 27)
fitMedia(CIARA_SET_THEME_ATMOS_2, 1, 29, 33)
fitMedia(CIARA_SET_DRUMBEAT_5, 3, 29, 33)
fitMedia(CIARA_SET_BASSLINE_2, 2, 29, 33)
for measure in range(22, 29, 1):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(29, 33)
elif genre == ("RNB"):
measure = []
fitMedia(CIARA_SET_THEME_ATMOS_1, 1, 1, 5)
fitMedia(CIARA_SET_THEME_ATMOS_1, 1, 7, 11)
fitMedia(CIARA_SET_DRUMBEAT_1, 3, 7, 11)
fitMedia(CIARA_SET_BASSLINE_2, 2, 7, 11)
setEffect(1, VOLUME, GAIN, 0, 4, -60, 6)
setEffect(1, VOLUME, GAIN, -60, 6, 0, 7)
fillDrum = CIARA_SET_DRUMBEAT_1
beat = "0+++0+++0-000+00"
index = randint(1,5)
if measure in range (1, 7, 1):
for index in range (index):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(7, 11)
fitMedia(CIARA_SET_THEME_ATMOS_1, 1, 10, 16)
fitMedia(CIARA_SET_THEME_ATMOS_1, 1, 18, 22)
fitMedia(CIARA_SET_DRUMBEAT_1, 3, 18, 22)
fitMedia(CIARA_SET_BASSLINE_2, 2, 18, 22)
for measure in range(11, 18, 1):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(17, 22)
fitMedia(CIARA_SET_THEME_ATMOS_1, 1, 23, 27)
fitMedia(CIARA_SET_THEME_ATMOS_1, 1, 29, 33)
fitMedia(CIARA_SET_DRUMBEAT_1, 3, 29, 33)
fitMedia(CIARA_SET_BASSLINE_2, 2, 29, 33)
for measure in range(22, 29, 1):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(29, 33)
elif genre == ("Rock"):
measure = []
fitMedia(RD_ROCK_POPELECTRICLEAD_2, 1, 1, 5)
fitMedia(RD_ROCK_POPELECTRICLEAD_2, 1, 7, 11)
fitMedia(RD_ROCK_POPELECTRICBASS_1, 3, 7, 11)
fitMedia(CIARA_SET_BASSLINE_2, 2, 7, 11)
setEffect(1, VOLUME, GAIN, 0, 4, -60, 6)
setEffect(1, VOLUME, GAIN, -60, 6, 0, 7)
fillDrum = RD_ROCK_POPELECTRICBASS_1
beat = "0+++0+++0-000+00"
index = randint(1,5)
if measure in range (1, 7, 1):
for index in range (index):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(7, 11)
fitMedia(RD_ROCK_POPELECTRICLEAD_2, 1, 10, 16)
fitMedia(RD_ROCK_POPELECTRICLEAD_2, 1, 18, 22)
fitMedia(RD_ROCK_POPELECTRICBASS_1, 3, 18, 22)
fitMedia(CIARA_SET_BASSLINE_2, 2, 18, 22)
for measure in range(11, 18, 1):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(17, 22)
fitMedia(RD_ROCK_POPELECTRICLEAD_2, 1, 23, 27)
fitMedia(RD_ROCK_POPELECTRICLEAD_2, 1, 29, 33)
fitMedia(RD_ROCK_POPELECTRICBASS_1, 3, 29, 33)
fitMedia(CIARA_SET_BASSLINE_2, 2, 29, 33)
for measure in range(22, 29, 1):
makeBeat(fillDrum, 3, measure, beat)
def myFunction(startMeasure, endMeasure):
fitMedia(CIARA_SET_BASSLINE_1, 4, startMeasure, endMeasure)
myFunction(29, 33)
finish()
Explanation: