| -- hc-ft | |
| -- | |
| -- human controled | |
| -- file transport | |
| -- | |
| -- ---------- | |
| -- | |
| -- adapted from @tehns angl. | |
| -- inspired by the HC-TT from | |
| -- landscape. | |
| -- | |
| -- ---------- | |
| -- | |
| -- @justmat v0.1 | |
| -- | |
| engine.name = 'Glut' | |
| local a = arc.connect(1) | |
| local tau = math.pi * 2 | |
| local VOICES = 4 | |
| local positions = {-1,-1,-1,-1} | |
| local alt = false | |
| function init() | |
| -- polls | |
| for v = 1, VOICES do | |
| local phase_poll = poll.set('phase_' .. v, function(pos) positions[v] = pos end) | |
| phase_poll.time = 0.025 | |
| phase_poll:start() | |
| end | |
| params:add_separator() | |
| local sep = ": " | |
| params:add_taper("reverb_mix", "*" .. sep .. "mix", 0, 100, 0, 0, "%") | |
| params:set_action("reverb_mix", function(value) engine.reverb_mix(value / 100) end) | |
| params:add_taper("reverb_room", "*" .. sep .. "room", 0, 100, 50, 0, "%") | |
| params:set_action("reverb_room", function(value) engine.reverb_room(value / 100) end) | |
| params:add_taper("reverb_damp", "*" .. sep .. "damp", 0, 100, 50, 0, "%") | |
| params:set_action("reverb_damp", function(value) engine.reverb_damp(value / 100) end) | |
| for v = 1, VOICES do | |
| params:add_separator() | |
| params:add_file(v .. "sample", v .. sep .. "sample") | |
| params:set_action(v .. "sample", function(file) engine.read(v, file) end) | |
| params:add_option(v .. "play", v .. sep .. "play", {"off","on"}, 1) | |
| params:set_action(v .. "play", function(x) engine.gate(v, x-1) end) | |
| params:add_taper(v .. "volume", v .. sep .. "volume", -60, 20, -10, 0, "dB") | |
| params:set_action(v .. "volume", function(value) engine.volume(v, math.pow(10, value / 20)) end) | |
| params:add_taper(v .. "speed", v .. sep .. "speed", -200, 200, 0, 0, "%") | |
| params:set_action(v .. "speed", function(value) engine.speed(v, value / 100) end) | |
| params:add_taper(v .. "jitter", v .. sep .. "jitter", 0, 500, 0, 5, "ms") | |
| params:set_action(v .. "jitter", function(value) engine.jitter(v, value / 1000) end) | |
| params:add_taper(v .. "size", v .. sep .. "size", 1, 500, 100, 5, "ms") | |
| params:set_action(v .. "size", function(value) engine.size(v, value / 1000) end) | |
| params:add_taper(v .. "density", v .. sep .. "density", 0, 512, 20, 6, "hz") | |
| params:set_action(v .. "density", function(value) engine.density(v, value) end) | |
| params:add_taper(v .. "pitch", v .. sep .. "pitch", -24, 24, 0, 0, "st") | |
| params:set_action(v .. "pitch", function(value) engine.pitch(v, math.pow(0.5, -value / 12)) end) | |
| params:add_taper(v .. "spread", v .. sep .. "spread", 0, 100, 0, 0, "%") | |
| params:set_action(v .. "spread", function(value) engine.spread(v, value / 100) end) | |
| params:add_taper(v .. "fade", v .. sep .. "att / dec", 1, 9000, 1000, 3, "ms") | |
| params:set_action(v .. "fade", function(value) engine.envscale(v, value / 1000) end) | |
| end | |
| params:read() | |
| params:bang() | |
| local arc_redraw_timer = metro.init() | |
| arc_redraw_timer.time = 0.025 | |
| arc_redraw_timer.event = function() arc_redraw() end | |
| arc_redraw_timer:start() | |
| redraw() | |
| end | |
| function key(n, z) | |
| if n == 2 then | |
| alt = z == 1 and true or false | |
| end | |
| end | |
| function a.delta(n, d) | |
| engine.seek(n, positions[n] + d / 1000) | |
| if alt then | |
| params:set(n .. "play", params:get(n .. "play") == 2 and 1 or 2) | |
| end | |
| end | |
| function arc_redraw() | |
| a:all(0) | |
| for i = 1, VOICES do | |
| a:segment(i, positions[i] * tau, tau * positions[i] + 0.2, 15) | |
| end | |
| a:refresh() | |
| end | |
| function redraw() | |
| screen.clear() | |
| screen.move(64,40) | |
| screen.level(15) | |
| screen.font_face(10) | |
| screen.font_size(30) | |
| screen.text_center("turn") | |
| screen.update() | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment