|
|
|
@ -21,7 +21,7 @@ lowestBpm = 92
@@ -21,7 +21,7 @@ lowestBpm = 92
|
|
|
|
|
highestBpm = 135 |
|
|
|
|
|
|
|
|
|
# force everything to happen within 1 bar |
|
|
|
|
oneBar = 1 |
|
|
|
|
oneBar = 0 |
|
|
|
|
|
|
|
|
|
# stack name |
|
|
|
|
# this doesn't matter, can be any string |
|
|
|
@ -60,8 +60,8 @@ percNames = ["kick", "hh", "sd", "cp", "ohh","ride","cymbal"]
@@ -60,8 +60,8 @@ percNames = ["kick", "hh", "sd", "cp", "ohh","ride","cymbal"]
|
|
|
|
|
noteRange = [12,24,36] |
|
|
|
|
# define the shortest and longest sequence you want |
|
|
|
|
# eg if shortest is 7, there will be no melodic sequences shorter than 7 |
|
|
|
|
shortestMelodic = 4 |
|
|
|
|
longestMelodic = 16 |
|
|
|
|
shortestMelodic = 3 |
|
|
|
|
longestMelodic = 10 |
|
|
|
|
|
|
|
|
|
# for melodic lines, what divisions do you want to choose from? |
|
|
|
|
# eg 4 = quarter notes, 8 = eighth notes |
|
|
|
@ -141,6 +141,7 @@ bpm = "setcps ("+str(random.randrange(lowestBpm, highestBpm, 1))+"/60/4)"
@@ -141,6 +141,7 @@ bpm = "setcps ("+str(random.randrange(lowestBpm, highestBpm, 1))+"/60/4)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####################### FUNCTIONS ################### |
|
|
|
|
|
|
|
|
|
def generateBinary(busyness): |
|
|
|
|
""" |
|
|
|
|
busy-ness (sic) |
|
|
|
@ -323,6 +324,26 @@ def fills():
@@ -323,6 +324,26 @@ def fills():
|
|
|
|
|
fills = str(random.choice(fillChoices))+" "+fills |
|
|
|
|
return "whenmod "+str(random.choice(whenmods))+" ("+fills.rstrip()+")" |
|
|
|
|
|
|
|
|
|
def sometimesBeQuiet(): |
|
|
|
|
""" |
|
|
|
|
Generate a gain pattern so that sometimes a track |
|
|
|
|
is silent, and other times it isn't |
|
|
|
|
""" |
|
|
|
|
#def genOnOff(limit,busyness,struct): |
|
|
|
|
# decide whether to do this at all |
|
|
|
|
if (random.randint(0,10) > 5): |
|
|
|
|
# for now, 8 bar phrases |
|
|
|
|
# (# gain "[0 1 0 0 1]/8") |
|
|
|
|
# how many cycles to make? |
|
|
|
|
quietCycles = random.choice([2,3,4]) |
|
|
|
|
quietBinary = genOnOff(quietCycles,2,0) |
|
|
|
|
# split 001001 into 0 0 1 0 0 1 |
|
|
|
|
quietBinary = list(quietBinary) |
|
|
|
|
finalQuietBinary = "" |
|
|
|
|
for i in quietBinary: |
|
|
|
|
finalQuietBinary = i + " " + finalQuietBinary |
|
|
|
|
print(indent+indent+"$ degradeBy \"<"+str(finalQuietBinary).rstrip()+">/8\"") |
|
|
|
|
|
|
|
|
|
########################### LISTS ########################## |
|
|
|
|
|
|
|
|
|
# a collection of typical-ish kick drum patterns |
|
|
|
@ -341,9 +362,11 @@ print("do")
@@ -341,9 +362,11 @@ print("do")
|
|
|
|
|
#print("") |
|
|
|
|
|
|
|
|
|
# create "let" statements |
|
|
|
|
print(indent+"let fourToTheFloor = 0") |
|
|
|
|
print(indent+" -- control density per track") |
|
|
|
|
for i in percNames: |
|
|
|
|
#print("let "+i+"M = \"["+genOnOff(4,5,0)+"]\"") |
|
|
|
|
print(indent+"let "+i+"M = \"[1111]\"") |
|
|
|
|
print(indent+" "+i+"M = \"[1111]\"") |
|
|
|
|
|
|
|
|
|
#print("") |
|
|
|
|
|
|
|
|
@ -382,7 +405,7 @@ print(indent+indent+"$ stack [")
@@ -382,7 +405,7 @@ print(indent+indent+"$ stack [")
|
|
|
|
|
# this is an empty track to make dealing with commas easier |
|
|
|
|
# just 4 to the floor in case you want it |
|
|
|
|
print(indent+indent+"-- four to the floor") |
|
|
|
|
print(indent+indent+"(#gain 1) $ struct \"[t*4]\" $ n \"0\" # midichan 0,") |
|
|
|
|
print(indent+indent+"degradeBy fourToTheFloor $ struct \"[t*4]\" $ n \"0\" # midichan 0,") |
|
|
|
|
|
|
|
|
|
# generate rhythm tracks |
|
|
|
|
# set the starting midi channel |
|
|
|
@ -401,6 +424,10 @@ for i in percNames:
@@ -401,6 +424,10 @@ for i in percNames:
|
|
|
|
|
# alter how dense the pattern is, by altering "let nnM = "[1111] |
|
|
|
|
print(indent+indent+"mask "+i+"M") |
|
|
|
|
|
|
|
|
|
# sometimes be quiet |
|
|
|
|
if (i != "kick"): |
|
|
|
|
sometimesBeQuiet() |
|
|
|
|
|
|
|
|
|
#### VARIATIONS ##### |
|
|
|
|
# insert some funStuff, maybe |
|
|
|
|
if (random.randint(0,10) > 3): |
|
|
|
@ -415,7 +442,7 @@ for i in percNames:
@@ -415,7 +442,7 @@ for i in percNames:
|
|
|
|
|
|
|
|
|
|
##### THE RHYTHMS ##### |
|
|
|
|
# how many bars to create? |
|
|
|
|
rhythmLengthChoices = [1,1,1,2] |
|
|
|
|
rhythmLengthChoices = [1,1,1,1,1,1,2,2] |
|
|
|
|
rhythmLength = random.choice(rhythmLengthChoices) |
|
|
|
|
|
|
|
|
|
# for the number of bars, do this: |
|
|
|
@ -424,7 +451,7 @@ for i in percNames:
@@ -424,7 +451,7 @@ for i in percNames:
|
|
|
|
|
|
|
|
|
|
# choose between random, type-specific (bd,hh,etc), |
|
|
|
|
# rhythm library, or euclidean rhythms |
|
|
|
|
rChoice = random.choice([0,1,2,3]) |
|
|
|
|
rChoice = random.choice([0,1,1,1,2,3]) |
|
|
|
|
rhythm = "" # placeholder for the rhythm |
|
|
|
|
if (rChoice == 0): |
|
|
|
|
# if choice = 0, choose hardcoded rhythms |
|
|
|
@ -496,8 +523,11 @@ for i in range(melodyCount):
@@ -496,8 +523,11 @@ for i in range(melodyCount):
|
|
|
|
|
print(indent+indent+"$ struct \""+genOnOff(16,(busyness),1)+"\"") |
|
|
|
|
print(indent+indent+"$ "+genNotes(1)) |
|
|
|
|
else: |
|
|
|
|
genOnOff(32,(busyness)) |
|
|
|
|
print(indent+indent+"$ struct \""+genNotes(1))+"\"" |
|
|
|
|
# how many 16th notes? |
|
|
|
|
thisLength = random.randint(3,16) |
|
|
|
|
#genOnOff(8,(busyness)) |
|
|
|
|
print(indent+indent+"$ struct \""+genOnOff(thisLength,(busyness),1)+"\"") |
|
|
|
|
print(indent+indent+"$ "+genNotes(0)) |
|
|
|
|
print(indent+indent+"# midichan "+str(melodicMidiChan)+" + n (-42)") |
|
|
|
|
melodicMidiChan = melodicMidiChan + 1 |
|
|
|
|
|
|
|
|
|