I can’t let this one lie. While I like the randomness injected using the one_in()
function, sometimes it did feel a bit too chaotic in some pieces. So I’ve augmented my general purpose drumkit to have a ‘mask’ type of function. So I can deterministically chose where in the bar variations are to go, then optionally apply a bit of randomness to that.
I can edit the mask for live playing. It gives a nicer feel - setting up a new pattern variation that I can let run for a bit. If I hear something I like, I can let it run for a few bars before changing it.
Ideally I would like something like the ‘Turing Machine’ eurorack module, where you can let it produce patterns itself, and you can lock it when you hear a good one. Not sure I can code that in SPi because of the immutable arrays.
define :r0 do
"1---2x--3---4-x-".ring.tick(:r0)=="x" and one_in(2)
end
#Drumkit with variations
use_bpm 120
live_loop :drumtest do
cue :bar
sleep 4
end
#Variation masks
define :r0 do
"1---2x--3---4-x-".ring.tick(:r0)=="x" and one_in(2)
end
define :r1 do
"1---2--x3---4xxx".ring.tick(:r1)=="x" and one_in(2)
end
live_loop :drums do
sync :bar
#stop
a = 1.0
n = tick(:bar)
s = [:drum_bass_hard,
:drum_snare_hard,
:drum_cymbal_closed,
:ambi_swoosh,
:elec_filt_snare,
:elec_blip,
:elec_blip2]
sample :ambi_swoosh if false
define :p do |i|
case i
when 0
sample s[i], beat_stretch: 1.5, amp: a*0.3
when 1
sample s[i], amp: a*0.2
when 2
sample s[i], beat_stretch: 1, amp: a*0.1*[2,1,1,1].ring.tick(:hat)
when 3
sample s[i], beat_stretch: 0.5, amp: a*0.1
when 4
sample s[i], beat_stretch: 2, amp: a*0.1
when 5
sample s[i], beat_stretch: 1.5, amp: a*0.1
when 6
sample s[i], beat_stretch: 1, amp: a*0.05
else
sample s[i], beat_stretch: 1, amp: a*0.1
end
end
with_fx :echo, mix: 0.1, phase: 0.75, decay: 6 do
with_fx :lpf, cutoff: 130 do
in_thread do
16.times do
tick
p(0) if ("x-----x-x-------"[look]=="x") ^ r0 #^ one_in(24)
p(1) if ("----x-------x---"[look]=="x") ^ r1 #^ one_in(24)
p(2) if ("xxxxxxxxxxxxxxxx"[look]=="x") #^ one_in(0)
#p(3) if ("----x-------x---"[look]=="x") #^ one_in(0)
#p(4) if ("-------x--x-----"[look]=="x") ^ one_in(24)
#p(5) if ("------x---x-----"[look]=="x") ^ one_in(18)
p(6) if ("-x--x--x--x-----"[look]=="x") ^ one_in(16)
sleep 1.0/4
end
end
end
end
end