Created
May 2, 2020 14:47
-
-
Save lctrt/fcc5c598b187b055b90d6b68f5fad469 to your computer and use it in GitHub Desktop.
Crow exploration #1
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
-- crow exploration #1 | |
function init() | |
metro[1].event = clock | |
metro[1].time = 2 | |
metro[1]:start() | |
metro[2].event = mod_speed | |
metro[2].time = 4 | |
metro[2]:start() | |
count = 0 | |
seq = {f1,f2,f1,f1,f1,f3,f1,f3,f4} | |
seq_l = 8 | |
pattern = {0,4,7,2,14,6,2,9,13} | |
pattern_pos = 1 | |
pattern_l = 9 | |
end | |
function mod_speed() | |
local times = {2,1,1,0.5,4,8} | |
metro[1].time = times[math.random(6)] | |
print('TIME ' .. metro[1].time) | |
end | |
function clock() | |
seq[count % seq_l + 1]() | |
count = count + 1 | |
end | |
function f1() | |
print('f1 ' .. pattern[pattern_pos]) | |
-- advance pattern | |
output[1].volts = n2v(pattern[pattern_pos]) | |
pattern_pos = (pattern_pos + 1) % pattern_l + 1 | |
end | |
function f2() | |
print('f2') | |
-- modulate on o2 | |
modulation2 = {to(math.random(4),1),to(math.random(8),1),to(0,2)} | |
output[2](modulation2) | |
end | |
function f3() | |
print('f3') | |
-- modulate on o3 | |
modulation3 = {to(2,1),to(0,1),to(math.random(6)+2,1)} | |
output[3](modulation3) | |
end | |
function f4() | |
print('f4') | |
-- random pattern jump | |
pattern_pos = math.random(pattern_l) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment