Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
osc_port = 9000
osc_host = '10.0.1.12'
local osccoords = {}
function mysplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
function norns.osc.event(path, args, from)
gridpath = mysplit(path)
-- send some osc back to light up buttons
osc.send({osc_host,osc_port},'/grid/key '..gridpath[2].." "..gridpath[3],args)
-- these come over as strings so coerce to number
osccoords = {tonumber(gridpath[2]),tonumber(gridpath[3]),tonumber(string.sub(args[1],0,1))}
-- tab.print(osccoords)
local x = osccoords[1]
local y = osccoords[2]
local s = osccoords[3]
gridkey(x, y, s)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment