Created
April 30, 2020 22:43
-
-
Save trentgill/c6659ef1b5bf98f0b50c0fe5a8756f30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- timeline sequencer | |
-- aka 'function tracker' | |
-- WARNING. NON FUNCTIONAL | |
line = 1 -- this makes it start at line 1! | |
function timeline_step(count) | |
if count == 1 then | |
print'1' | |
return | |
end | |
if count == 2 then | |
print'2' | |
metro[1]:stop() | |
return | |
end | |
tl[line][2]() | |
local dur = tl[line][1] | |
line = line +1 | |
if not tl[line] then return end -- stop the timeline | |
dur = tl[line][1] - dur | |
metro[1].time = dur | |
end | |
function f1() | |
print('f1') | |
ii.jf.play_note(0, 5) | |
end | |
function f2() | |
ii.jf.run(-5) | |
ii.jf.play_note(4/12, 3) | |
output[3].volts = 0 | |
end | |
function f3() | |
ii.jf.play_note(7/12, 6) | |
end | |
function f4() | |
ii.jf.run(0) | |
output[3].volts = 5 | |
end | |
function restart() | |
line = 1 | |
timeline_step() | |
end | |
function init() | |
output[3].slew = 2 | |
ii.jf.mode(1) | |
ii.jf.run_mode(1) | |
metro[1].time = 1 | |
metro[1].event = timeline_step | |
metro[1]:start() | |
end | |
-- time -- action | |
tl = | |
{ { 0 , f1 } | |
, { 1 , f2 } | |
, { 2.5, f3 } | |
, { 2.7, f1 } | |
, { 3.2, f4 } | |
, { 4 , restart } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment