Inspired by @martin’s code (thank you) here’s my go at a randomised sequence generator, where the sequence stays stuck until I want to change it. I’m sure this will be useful.
But this is the point where someone gently points out that Sam’s written an in-built one already.
I’m starting to want to have my own function library - is that possible?
#Sequencer Generator
#Randomised sequences that stick
use_bpm 80
define :getseq do |length, notes, seed|
#Generate a randomised sequence based on the seed
seq=[]
use_random_seed seed
for i in 0..length-1
seq.push(notes[rrand_i(0,notes.length-1)])
end
seq.ring
end
notes = scale :C4, :major, num_octaves: 1
#Change the sequence length and seed
seq1 = getseq(7,notes,1)
live_loop :main do
8.times do
play seq1.tick, amp: 0.2
sleep 0.25
end
end
live_loop :bass, sync: :main do
play :C3, amp: 0.2
sleep 1
end