Skip to content

Instantly share code, notes, and snippets.

@jlmitch5
Created March 30, 2020 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlmitch5/9b2d1ae4925e924323e968b8507f4ac0 to your computer and use it in GitHub Desktop.
Save jlmitch5/9b2d1ae4925e924323e968b8507f4ac0 to your computer and use it in GitHub Desktop.
braided generative pattern sequencer ~ midcentury modular livestream 1 ~ 3/29/20 1pm EDT ~ twitch.tv/midcenturymodular
--- braided generative pattern sequencer ~ midcentury modular livestream 1 ~ 3/29/20 1pm EDT ~ twitch.tv/midcenturymodular
-- originally inspired by bowery/shiftregister.lua and mudlogger - kubota
-- input 1: performance...plugged in lfo
-- 0 - 1.66v = slow down mangrove, 1.67v - 3.33v 3rd speed up mangrove, 3.34v - 5v 3rd octave up jf
-- input 2: clock
-- output 2: mangrove pitch cv
-- ii: 6 stages of ASR via just friends
reg = {}
scale = { 0,2,4,5,7,9,11,16,21 }
scale2 = { 2,0,4,7,16,5,11,19,23 }
note = 0
scaleChange = 1
numRepetitionsScale = 8 * #scale
mangroveDivision = 3
mangroveSeed = 1
oct = -1
function createVoctScale()
vOct = { }
for n=1,#scale do
coin = math.random(1, 2)
if coin == 1 then
table.insert(vOct, scale[n] * 1/12)
else
table.insert(vOct, scale2[n] * 1/12)
end
end
end
q = {}
function init()
output[1].slew = 0
output[2].slew = 0.02
createVoctScale()
input[2]{ mode = 'change'
, direction = 'rising'
}
metro[1].event = iiseq
metro[1].time = 0.005
metro[1]:start()
ii.jf.mode(1)
end
function iiseq()
if #q > 0 then
ii.jf.play_note(table.remove(q),5)
end
end
input[2].change = function()
if input[1].volts < 5/3 then
oct = -1
elseif input[1].volts >= 5/3 and input[1].volts <= ((5/3) * 2) then
oct = -1
else
oct = 0
end
if scaleChange == 0 then
mangroveSeed = math.random(1, 7)
createVoctScale()
mangroveDivision = math.random(1,2)
end
table.remove(reg)
newVoltVal = vOct[note % #vOct + 1] + oct
note = note + 1
scaleChange = (scaleChange + 1) % numRepetitionsScale
mangroveNote = note % mangroveDivision
if mangroveNote == 0 then
output[2].volts = vOct[(note + mangroveSeed) % 7 + 1]
end
table.insert(reg, 1, newVoltVal)
for n=1,6 do
table.insert(q, reg[n])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment