Answer:
from earsketch import *
setTempo(120)
init() # fixed spelling of function name
setTempo(120) # removed unnecessary second call to setTempo
def sectionA(startMeasure, endMeasure):
# added indentation to the next line
setEffect(1, DISTORTION, DISTO_GAIN, 2, 1)
drums1 = CIARA_MELANIN_THEME_TUBA_2 # fixed spelling of variable name
drums2 = CIARA_MELANIN_DRUMBEAT_1 # fixed spelling of variable name
synth = RD_FUTURE_DUBSTEP_SUBBASS_2 # removed unnecessary parentheses
fitMedia(drums1, 1, startMeasure, endMeasure)
fitMedia(drums2, 3, startMeasure + 5, startMeasure + 9)
fitMedia(synth, 3, 17, 29)
#Delay
setEffect(1, DELAY, DELAY_TIME, 350)
beat1 = "-00-00+++00--0-0-00--00-00+"
beat2 = "0--0--000-000--00-0--00-0-0"
#Beat Pattern of audio every quarter note
beatPattern = "0+++0+++0-000+00"
# added range end value
for measure in range(1, 45, 2):
makeBeat(drums2, 2, measure, beatPattern)
sectionA(1, 15)
sectionA(31, 46)
finish()