Skip to content

Instantly share code, notes, and snippets.

@okyeron
Created November 28, 2019 05:55
Show Gist options
  • Save okyeron/8414466930830272d9d2e8499ec38ee0 to your computer and use it in GitHub Desktop.
Save okyeron/8414466930830272d9d2e8499ec38ee0 to your computer and use it in GitHub Desktop.
local sc = include("lib/tlps")
sc.file_path = "/home/we/dust/audio/tape/notis."
local lfo = include("lib/hnds")
local muted_L = false
local muted_R = false
rate = 1.0
rec = 1.0
pre = 0.0
-- for lib/hnds
local lfo_targets = {
"none",
"1vol",
"2vol",
}
-- for lib/hnds
function lfo.process()
for i = 1, 4 do
local target = params:get(i .. "lfo_target")
if params:get(i .. "lfo") == 2 then
-- left/right volume
if target > 1 and target <= 3 then
params:set(lfo_targets[target], lfo[i].slope)
end
end
end
end
function init()
sc.init()
-- for lib/hnds
for i = 1, 4 do
lfo[i].lfo_targets = lfo_targets
end
lfo.init()
params:bang()
softcut.buffer_clear()
softcut.enable(1,1)
softcut.buffer(1,1)
softcut.level(1,1.0)
softcut.loop(1,1)
softcut.loop_start(1,1)
softcut.loop_end(1,3)
softcut.position(1,1)
softcut.play(1,1)
-- set input rec level: input channel, voice, level
softcut.level_input_cut(1,1,1.0)
softcut.level_input_cut(2,1,1.0)
-- set voice 1 record level
softcut.rec_level(1,rec)
-- set voice 1 pre level
softcut.pre_level(1,pre)
-- set record state of voice 1 to 1
softcut.rec(1,1)
local screen_metro = metro.init()
screen_metro.time = 1/30
screen_metro.event = function() redraw() end
screen_metro:start()
end
function key(n, z)
end
-- norns controls --
local function mix_enc(n, d)
if n == 2 then
if not muted_L then
params:delta("1vol", d)
end
elseif n == 3 then
if not muted_R then
params:delta("2vol", d)
end
end
end
function enc(n, d)
mix_enc(n,d)
end
-- screen drawing
local function draw()
screen.level(10)
screen.move(64, 15)
screen.text_center("trem L : " .. string.format("%.2f", params:get("1vol")))
screen.move(64, 23)
screen.text_center("trem R : " .. string.format("%.2f", params:get("2vol")))
end
function redraw()
screen.clear()
screen.aa(0)
screen.font_face(25)
screen.font_size(6)
screen.move(30 * 1, 5)
-- current page indication
draw()
screen.update()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment