Hello, geikha here!
I want to show you another function I use often. The original idea is from @alejandrosame , who used it as a way to generate complex, non-random, drum breaks for breakcore-like music. His code was similar to the following:
do
setcps (168 / 60 / 4)
d1 $ n (run 16 |% "<16 _ _ [5 _ 2]>") # s "amencutup" # cut 1 |+ sp 1.5
Note that Alejandro wasn't using "amencutup" exactly, he had his own cut-up breaks.
We were rehearsing for an Algorave in-person, and there I suggested the idea of turning that into a simple function, then we started exploring other possibilities:
runmod
runmod
takes 3 numbers, the number to which to run ("0..n"
), a modulus to apply and an offset. The following example should self-explain by listening to it:
do
resetCycles
let runmod r m o = ((run r) |% m |+ o)
d1 $ n (slow 2 $ runmod 8 5 "<0 2>/2") |+ n 1 # s "numbers" # legato 1 # speed 2
d2 $ "bd/2"
runmod 8 5 "<0 2>/2" |+ 1 (adding one to make it easier to grasp) :
|123451234|123451234|345673456|345673456|
Usage on drums
The original use Alejandro gave to the function:
d1 $ slice 16 (runmod 16 "<16 _ 8 [3 1]>" 0) $ "breaks125" # cut 1 |+ note 5
Usage on melodic loops
do
d1 $ slice 32 (slow 2 $ runmod 32 "7" "<0 10>") $ "bev" # cut 1
# speed 2 # room 0.4 # size 0.8
d2 $ "808bd:3*4" # shape 0.6 # cut 1
Usage as melody
do
d1 $ note (scale "phrygian" $ runmod 16 "<5 7>/4" "0@5e <0 -2>") # "gtr:1"
# cut 1 # speed 2 # release 0.1
# lpf (range 700 10000 $ slow 3 sine)
# gain 0.7 # delay 0.2 # delayt 0.4
d2 $ "808bd:3(5,8)" # shape 0.6 # cut 1
runmod'
runmod'
adds a multiplier to the runmod
function. This is very useful for melodic elements!
let runmod' r m mul o = ((run r) |% m |* mul |+ o)
Usage as melody
do
d1 $ note (scale "phrygian" $ runmod' 16 "<5 7>/4" "<[1 <2 -2>] 3>/3" "0@5e <0 -2>") # "gtr:1"
# cut 1 # speed 2 # release 0.1
# lpf (range 700 10000 $ slow 3 sine)
# gain 0.7 # delay 0.2 # delayt 0.4
d2 $ "808bd:3(5,8)" # shape 0.6 # cut 1
Here the notes instead of simply increasing one by one, in some parts it jumps by 2, others it decreases by 2, and others it jumps by 3.
Usage on melodic loops
do
d1 $ slice 32 (slow 2 $ runmod' 32 7 3 "<0 10>") $ "bev" # cut 1
# speed 2 # room 0.4 # size 0.8
d2 $ "808bd:3*4" # shape 0.6 # cut 1
Note how now that the
run
is multiplied,slice
reaches very different parts of the sample.
slicemod, bitemod
You may want to use an utility slicemod
function if you know you'll slice
the sample by the same amount you'll run
.
let slicemod r m o = slice r (runmod r m o)
bitemod r m o = bite r (runmod r m o)
do
d1 $ slicemod 16 7 "<0 10>" $ "bev" # cut 1
# speed 2 # room 0.4 # size 0.8 # rel 0.1
d2 $ "808bd:3*2" # shape 0.6 # cut 1
bite
it's basically a slice
for Pattern
's, so you could also use these functions to modify them:
do
d1 $ bitemod 8 5 0 $ stack [
s "bd ~ [~ bd] ~"
, "1*16" # s "hh27" # release 0.4
, press "1*2" # s "909sd"
,"<~ [~ 808ht]>"
]
Tidal definitions
let runmod r m o = ((run r) |% m |+ o)
runmod' r m mul o = ((run r) |% m |* mul |+ o)
slicemod r m o = slice r (runmod r m o)
bitemod r m o = bite r (runmod r m o)
Strudel definitions
let runmod = (r,m,o) => run(r).mod(m).add(o)
let runmod_ = (r,m,mult,o) => run(r).mod(m).mul(mult).add(o)
n(runmod(8,5,2)).scale("C:major").s("square").sustain(0.2)
// n(runmod_(8,5,2,2)).scale("C:major").s("square").sustain(0.2)