Last active
June 29, 2020 21:51
-
-
Save P0ed/d158ff29788ef7292b3b17729f8b1efe 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
--- Din sync 24 ppqn | |
-- input[1]: clock | |
-- input[2]: reset | |
-- output[1]: beats | |
-- output[2]: 16-th notes | |
-- output[3]: 4/3 kind of stuff for and|or|xor with output[2] | |
-- output[4]: five step sequence which advances on beat | |
function init() | |
local count = 0 | |
local sequence = { 0.0, 3.7, 2.2, 0.8, 1.3 } | |
local step = 0 | |
input[1]{ | |
mode = 'change', | |
direction = 'rising', | |
change = function() | |
count = (count % 24) + 1 | |
output[1].volts = count <= 12 and 5 or 0 | |
output[2].volts = count % 6 <= 3 and 5 or 0 | |
output[3].volts = count % 16 <= 8 and 5 or 0 | |
if count == 1 then | |
step = (step % 5) + 1 | |
output[4].volts = sequence[step] | |
end | |
end | |
} | |
input[2]{ | |
mode = 'change', | |
direction = 'rising', | |
change = function() | |
count = 0 | |
step = 0 | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment