Skip to content

Instantly share code, notes, and snippets.

@trentgill
Last active June 8, 2021 01:27
Show Gist options
  • Save trentgill/4b8c8fc4279f5290a6b267e9545d48cd to your computer and use it in GitHub Desktop.
Save trentgill/4b8c8fc4279f5290a6b267e9545d48cd to your computer and use it in GitHub Desktop.
flash crash quantizer script
--- flash crash
-- quantizer & w/syn output
function init()
input[1].mode('scale',{0,1,2,3,4,5,6,7,8,9,10,11})
ii.wsyn.ar_mode(1)
ii.wsyn.fm_ratio(1)
output[2].action = pulse()
end
--- big LUT mapping 10 octaves of 12 steps to sequences
-- well i actually forgot to make the last 4 octaves worth...
SEQ =
{ { 0,2,9 ,7,-12,-1, 4, 0, 16,14,6,19}
, { 12,4,6 ,7, 6, 2,-12,-10, 2, 0,6, 7}
, {-17,6,14,0,-20, 4, 19, -1,-24,-6,4,11}
, {-25,6,16,0,-27, 4, 19, -1,-29,-6,4,11}
, {-17,5,17,0,-14, 3, 19, -2,-26,-7,3,10}
, {-12,-9,-6,-3,0,3,6,9,12,15,18,21}
}
input[1].scale = function(s)
-- use s.octave to choose sequence
ii.wsyn.lpg_time(-input[2].volts)
local note = SEQ[s.octave + 1][s.index]/12
ii.wsyn.play_note(note, 1)
output[1].volts = note
output[2]()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment