Browse Source

fixed some bugs; implemented 'sometimesBeQuiet' so in 8 bar phrases, sometimes a track doesn't play

master
spoonietunes 2 years ago
parent
commit
3858957994
  1. 48
      auto-techno.py
  2. 107
      deleteme.tidal

48
auto-techno.py

@ -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

107
deleteme.tidal

@ -1,63 +1,74 @@ @@ -1,63 +1,74 @@
p "techno" $ struct "t*4" $ n "0" # sunvox
hush
-- seed: -413486887982277853
-- generated at 1633532891.3
-- raw input: 268982558670766555
-- hex seed: 0x3BB9E364458C1DB
-- decimal seed: 268982558670766555
-- generated at 1633539511.09
-- Auto-Techno Generator v0.1
do
let kickM = "[1111]"
let hhM = "[1111]"
let sdM = "[1111]"
let cpM = "[1111]"
let ohhM = "[1111]"
let rideM = "[1111]"
let cymbalM = "[1111]"
let fourToTheFloor = 0
-- control density per track
kickM = "[1111]"
hhM = "[1111]"
sdM = "[1111]"
cpM = "[1111]"
ohhM = "[1111]"
rideM = "[1111]"
cymbalM = "[1111]"
p "techno"
$ whenmod 8 7 (stut 4 1 "1/16")
$ whenmod 32 31 (rev)
-- fills
$ whenmod 32 30 (rev)
$ whenmod 32 31 (stut 2 1 "0.125")
$ whenmod 32 30 (scramble 16)
$ whenmod 16 15 (rev)
$ whenmod 64 62 (rev)
$ stack [
-- four to the floor
(#gain 0) $ struct "[t*4]" $ n "0" # midichan 0,
-- kick -----------------
degradeBy fourToTheFloor $ struct "[t*4]" $ n "0" # midichan 0,
-------------- kick ---------------
mask kickM
$ every 3 ((0.1875 ~>))
$ every 10 ((0.1875 ~>))
$ every 7 (rev)
$ every 6 ((0.125 ~>))
$ (0.125 ~>)
$ struct "<[t*4]>"
$ n 0 # midichan 0,
-- hh -----------------
$ struct "<[{0101011}%16]>"
$ n 1 # midichan 0,
-------------- hh ---------------
mask hhM
$ every 16 ((0.1875 ~>))
$ every 16 (scramble 8)
$ every 15 ((0.125 ~>))
$ struct "<[1*16]>"
$ n 3 # midichan 1,
-------------- sd ---------------
mask sdM
$ every 15 (stut 5 1 "0.0625")
$ (0.125 ~>)
$ struct "<{000101}%16 {100000001}%16>"
$ n 2 # midichan 1,
-- ride -----------------
$ struct "<[t(15,16)]>"
$ n 2 # midichan 2,
-------------- cp ---------------
mask cpM
$ degradeBy "[0 0 1]/8"
$ struct "<[{0000100}%16]>"
$ n 3 # midichan 3,
-------------- ohh ---------------
mask ohhM
$ struct "<[tt*2]*4 [[0001]]*4>"
$ n 0 # midichan 4,
-------------- ride ---------------
mask rideM
$ every 3 (stut 2 1 "1/8")
$ (0.125 ~>)
$ struct "<[t(2,8)] [tttt*2?]>"
$ n 3 # midichan 5,
-- cymbal -----------------
mask cymbalM
$ every 4 (scramble 8)
$ every 12 ((0.1875 ~>))
$ every 10 (scramble 8)
$ every 5 (rev)
$ every 13 (scramble 8)
$ (0.1875 ~>)
$ struct "<[01]*2>"
$ n 1 # midichan 6,
$ struct "<[t(4,16)]>"
$ n 0 # midichan 5,
-------------- cymbal ---------------
mask cymbalM
$ every 8 (rev)
$ every 7 (rev)
$ every 12 (stut 5 1 "0.0625")
$ struct "<[{10011000}%16]>"
$ n 3 # midichan 6,
-----------------------
degradeBy 0
$ struct "{1011111111011101}%16"
$ n "{23 21 20 3 6 32 10 19 9 9 0 0 10 0 2 11 }%16"
$ struct "[{0010100000000000}%16]"
$ n "[{18 6 8 7 19 35 8 24 11 7 7 8 3 23 8 33 }%16]"
# midichan 7 + n (-42)
] # sunvox
p "techno"
$ every 16 ((0.1875 ~>))
$ (0.125 ~>)
-- $ struct "<{000101}%16 {100000001}%16>"
$ struct "t*4"
$ n 2 # midichan 1,

Loading…
Cancel
Save