I’ve written a little toy to line up hex values common in trackers (like my beloved Adlib Tracker II) with rhythmic counting devices like
the code is a little rough, but I'm proud of it and think it might be useful to some!
-- tracker tool
-- ttool
--
-- easy to use rulers for
-- all sorts of tracking
-- scenarios
--
-- TODO: add params
-- for which counts
-- are displayed
-- rather than all at once
--
-- TODO: add custom rulers
-- maybe chord progs
-- ill hardcode some first
--
-- TODO: split counts off into
-- a little lib
-- so i can store
-- a default instance
-- in a var
--
-- ---idea:
-- local n = {},{},{}
-- counts = require lib/counts
--
-- function init()
-- for i=1,3 do
-- n[i] = counts.newBlank()
-- end
--
-- ---lib/counts--------
-- function newBlank()
-- local t = {}
-- local mt = {
-- __index = function (t, k)
-- return "---"
-- end }
-- t = setmetatable(
-- counts.blank, mt)
-- return t
-- end
engine.name = "TestSine"
counts = {
blank = {},
hex = {}, -- see hex_mt
four_four={
quarter={
[1]="one",[5]="two",[9]="three",[13]="four"
},
eigth={
[1]="one",[5]="two",[9]="three",[13]="four",
[3]="and",[7]="and",[11]="and",[15]="and"
},
sixteenth={
[1]="1",[5]="2",[9]="3",[13]="4",
[2]="e",[6]="e",[10]="e",[14]="e",
[3]="&",[7]="&",[11]="&",[15]="&",
[4]="a",[8]="a",[12]="a",[16]="a"
},
takadimi={
"ta", "ka", "di", "mi",
"ta", "ka", "di", "mi",
"ta", "ka", "di", "mi",
"ta", "ka", "di", "mi"
}
}
}
local counts_mt = { __index = function (t, k) return "---" end }
local hex_mt = {
__index = function (t,k)
return string.format('%02x', k-1)
end
}
function counts_metatables()
-- TODO: apply metatable to each counts.x.y table for x,y
counts.blank = setmetatable(
counts.blank, counts_mt)
counts.four_four.quarter = setmetatable(
counts.four_four.quarter, counts_mt)
counts.four_four.eigth = setmetatable(
counts.four_four.eigth, counts_mt)
counts.four_four.sixteenth = setmetatable(
counts.four_four.sixteenth, counts_mt)
counts.hex = setmetatable(
counts.hex, hex_mt)
end
function init()
counts_metatables()
re=metro.init()
re=metro.init()
re.time = 1.0/15
re.event = function()
redraw()
end
screen_init()
re:start()
end
function screen_init()
screen.aa(1)
end
local scroll = 0
local column_positions = {2, 16, 30, 46, 58, 72, 88, 98, 112}
local c_p_hl= { 2, 3, 5, 6, 8, 9 }
local row_offset = 6
local hx,hy = 1,1
function redraw()
screen.clear()
screen.level(10)
screen.font_face(1)
screen.font_size(8)
for i=1,16 do
-- COL 1 -- HEX
fx_move(
column_positions[1],
row_offset*(i-scroll)) -- start @ 2
screen.text(counts.hex[i])
-- COL 2 -- NOTE 1
fx_move(
column_positions[2],
row_offset*(i-scroll)) -- n1 = start + 14
screen.text(counts.blank[i])
-- COL 3 -- FX 1
fx_move(
column_positions[3],
row_offset*(i-scroll)) -- f1 = n1 + 14
screen.text(counts.blank[i])
-- COL 4 -- RULER 1
fx_move(
column_positions[4],
row_offset*(i-scroll)) -- r1 = f1 + 16
screen.text(
counts.four_four.takadimi[i])
-- COL 5 -- NOTE 2
fx_move(
column_positions[5],
row_offset*(i-scroll)) -- n2 = r1 + 12
screen.text(counts.blank[i])
-- COL 6 -- FX 2
fx_move(
column_positions[6],
row_offset*(i-scroll)) -- f2 = n2 + 14
screen.text(counts.blank[i])
-- COL 7 -- RULER 2
fx_move(
column_positions[7],
row_offset*(i-scroll)) -- r2 = f2 + 16
screen.text(
counts.four_four.sixteenth[i])
-- COL 8 -- NOTE 3
fx_move(
column_positions[8],
row_offset*(i-scroll)) -- n3 = r2 + 10
screen.text(counts.blank[i])
-- COL 9 -- FX 3
fx_move(
column_positions[9],
row_offset*(i-scroll)) -- f3 = n3 + 14
screen.text(counts.blank[i])
end
-- OPERATIONS THAT USE THIS RECTANGLE
-- AS THEIR TARGERT
-- NEED TO OPEPRATE ON Y+SCROLL
screen.level(6)
fx_rect(
column_positions[c_p_hl[math.floor(hx)]],
row_offset*(math.floor(hy)-1),
12, row_offset)
screen.stroke()
screen.update()
end
function fx_move(x,y,fx)
local xscale,yscale = 1,1
-- TODO: what if i made everything wiggle by doing something fun in here
screen.move(x*xscale,y*yscale)
end
function fx_rect(x,y,w,h)
local xscale,yscale = 1,1
-- TODO: what if i made rectangles move around by doing something fun in here
screen.rect(x*xscale,y*yscale,w,h)
end
function enc(n,d)
if n == 1 then
scroll = util.clamp((scroll + d), 0, 6)
elseif n == 2 then
hx = util.clamp((hx + d*0.2), 1,6)
elseif n == 3 then
hy = util.clamp((hy + d*0.4), 1,16)
end
end
Update: i’ve got the bug. This turned into a tracker using softcut as it’s sampler and it will be finished and released as soon as I can manage it. If anyone wants to help build or test I’m slightly in over my head but having a great time!