I’ve stripped it right back for testing porpoises. Try this one:
link_clock_test.zip (4.7 KB)
– UPDATE
This version doesn’t even trigger a sound, and I’m still getting resets on step 16, 17 and 18.
--
-- Link Clock Test
--
-- v0.5.5 @toneburst
local ControlSpec = require 'controlspec'
engine.name = "GridKit"
-- Step position
local step = 1
-- States of the 3 Norns buttons
local button_states = {0,0,0}
local pattern = {
{1,0,0,0,0,0,0.568627451,0,0,0,0,0,0.8549019608,0,0,0,0.2823529412,0,0.1411764706,0,0.7137254902,0,0,0,0.4274509804,0,0,0,0.2823529412,0,0,0},
{0.1411764706,0,0.4274509804,0,0,0,0.031372549,0,1,0,0,0,0,0,0.2823529412,0,0,0,0.7137254902,0,0,0,0.1411764706,0,0.8549019608,0,0,0,0.568627451,0,0,0},
{0.6666666667,0,0.4431372549,0,1,0,0.2196078431,0,0.6666666667,0,0.5529411765,83,0,0.7764705882,0,0.2196078431,0,0.6666666667,0,0.4431372549,0,0.8862745098,0,0.1098039216,0,0.6666666667,0,0.4431372549,0,0.7764705882,0,0.3333333333},
}
--------------------
-- Main ------------
--------------------
function init()
-- Restart screen saver timer
screen.ping()
-- Default render Style
screen.level(15)
screen.aa(0)
screen.line_width(1)
screen.font_size(8)
params:add_control("thresholdkick","density kick",ControlSpec.new(0.0,1.0,'lin',0,0.5))
params:add_control("thresholdsnare","density snare",ControlSpec.new(0.0,1.0,'lin',0,0.25))
params:add_control("thresholdhat","density hat",ControlSpec.new(0.0,1.0,'lin',0,0.8))
-- Norns new Global Clock (with link support!!)
function bar()
while true do
clock.sync(4)
reset_counter()
end
end
clock.run(bar)
function pulse()
while true do
clock.sync(1/4)
pre_step()
end
end
clock.run(pulse)
end -- end init()
-- Reset clock
function reset_counter()
print("RESET: count: " .. step)
screen.clear()
screen.move(5, 10)
screen.text("RESET: count: " .. step)
screen.update()
step = 1
end
-- Function runs before step
function pre_step()
-- debug
--print(clock.get_beats())
-- Run step function
do_step()
-- Update step counter
if step == 32 then
step = 0
else
step = step + 1
end
end
function do_step()
--print("step".. step)
-- if pattern[1][step] > (1 - params:get('thresholdkick')) then
-- engine.trig_kick(0.3)
-- end
-- if pattern[2][step] > (1 - params:get('thresholdsnare')) then
-- engine.trig_snare(0.3)
-- end
-- if pattern[3][step] > (1 - params:get('thresholdhat')) then
-- engine.trig_hat(0.3)
-- end
end --end do_step()
--------------------
-- Interactions ----
--------------------
function key(id,state)
end --end key()
function enc(id,delta)
end --end enc()
--------------------
-- Render ----------
--------------------
function redraw()
end --end redraw()