Skip to content

Instantly share code, notes, and snippets.

@trentgill
Created May 27, 2019 14:28
Show Gist options
  • Save trentgill/47c05d89ea22a36e5b88fa3147644126 to your computer and use it in GitHub Desktop.
Save trentgill/47c05d89ea22a36e5b88fa3147644126 to your computer and use it in GitHub Desktop.
--- default
-- a really weird way of writing a 30segment lfo
-- output 1 is the main output
-- outputs 2-4 are the default lfos
-- should probably add cv control over rate
-- start all the output actions
function init()
for c=1, 4 do
output[c].asl:action()
end
end
-- 3 sequences of note-nums: these should be controlled
a = { 2, 4, 7 }
b = { 0, 12 }
c = { 11, 6, 9, 14, 18 }
-- give each sequencer a playhead
seq1 = { ix = 0, notes = a }
seq2 = { ix = 0, notes = b }
seq3 = { ix = 0, notes = c }
-- speed. could be a sequence itself!
time = 0.5
-- create a generator to return next note in sequence
local function nx( seq )
return function()
seq.ix = seq.ix+1
if seq.ix > #seq.notes then seq.ix = 1 end
return seq.notes[seq.ix]/12.0
end
end
-- interleave the 3 sequences
output[1].asl:action(
weave{ loop{ toward( nx(seq1), time, 'linear' ) }
, loop{ toward( nx(seq2), time, 'linear' ) }
, loop{ toward( nx(seq3), time, 'linear' ) }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment