Created
April 23, 2020 22:30
-
-
Save trentgill/b21695d3ddd2ddbd9aa35950b4f277cd 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
function init() | |
-- start stuff | |
input[2].mode( 'change' ) | |
--output[1]( macroseq(0.3) ) | |
--output[2]( lfo(0.4) ) | |
--output[3]( lfo(2) ) | |
output[3].scale{ 0,3,7,10 } | |
output[3]( zoom() ) | |
output[4]( lfo(0.3) ) | |
end | |
sc = { {0,3.3,7,10} | |
, {0,7,3,2,10} | |
, {2,4,7,11, 11.1, 11.3, 11.5} | |
} | |
ix = 1 | |
function change_scale() | |
ix = ix % #sc + 1 | |
output[3].scale( sc[ix] ) | |
end | |
function zoom() | |
return loop{ times( 4, {to(1, 1.4) | |
, to(-1, 0) | |
, to(2, 0.5) | |
, to(0, 0) | |
} ) | |
, change_scale | |
} | |
end | |
input[2].change = function(dir) | |
--output[2](dir) | |
--output[2].asl:action(dir) | |
end | |
A_len = 1 | |
function stepseqA() -- random sequence | |
return math.random(36)/12 | |
end | |
B_len = 20 | |
min7 = {0,3,7,10,14} | |
m7_ix = 1 | |
function stepseqB() -- minor 7 arpeggio | |
m7_ix = m7_ix % #min7 +1 --increment & wrap | |
return min7[m7_ix]/12 | |
end | |
function macroseq(t) | |
return loop{ times( A_len, { to( stepseqA, t, 'now' ) } ) | |
, times( B_len, { to( stepseqB, t, 'now' ) } ) | |
} | |
end | |
note_ix = 1 | |
notes = {0,2,4,6,7,9,11} | |
function new_pitch() | |
output[1].slew = math.random()/3 | |
--output[1].volts = notes[note_ix] / 12 | |
output[1].volts = notes[math.random(7)] /12 | |
note_ix = (note_ix % #notes) +1 | |
end | |
_level = 3 | |
function new_level() | |
return _level | |
end | |
function seq() | |
return loop{ new_pitch | |
, function() ii.jf.play_note( 1, 5 ) end | |
, function() output[3]( ar() ) end | |
, to( new_level, 0.01 ) | |
, to( 0, math.random ) | |
} | |
end | |
local oct = 0 | |
function flip_octave() | |
print'flip_oct' | |
oct = (oct == 0) and 1 or 0 | |
--output[1].volts = oct | |
end | |
function multiouts() | |
--return loop{ flip_octave() | |
-- , to( 5, 1 ) | |
-- , to( -5, 1 ) | |
-- } | |
return loop{ to( 5, 1 ) | |
, flip_octave() | |
, to( -5, 1 ) | |
} | |
end | |
function threetimes() | |
return loop{ times( 3, { to(5,0.2) | |
, to(-5,0.4) | |
} ) | |
, to(5,1) | |
, to(-5,1) | |
} | |
end | |
function lfo2( time ) | |
return loop{ to( 8, time*0.1 ) | |
, to( -5, time*0.9 ) | |
, to( 2, 2 ) | |
, to( 10, 0.3 ) | |
, to( 0, 0.1) | |
} | |
end | |
function adsr2() | |
return { held{ to(8, 10) --attack | |
, to(2, 0.3) --decay&sustain | |
} | |
, to(0, 0.1) --release | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment