at its most basic, it’d be:
local m
local clock_id
function clock_tick()
while true do
clock.sync(1/(4*24)) -- 24 ppqn
m:clock()
end
end
function start_clock_out()
m = midi.connect()
clock_id = clock.run(clock_tick)
end
function stop_clock_out()
clock.cancel(clock_id)
end
just drop that in your script, call start_clock_out() when you’d like, and call stop_clock_out when you’d like.
while i’m fairly confident the above works (i pulled it out of my script Cyrene, which is a bit more complex), it’d be cool to not require it. i see that norns’ global clock has a “midi out” option, but it didn’t do quite what i expected when i turned that from “off” to “port 1” or “port 2”. i’ll have to dig around in the code a bit to see what it’s trying to do (or someone else who knows about it could reply here and educate us!)
EDIT: we’re DMing about this – you shouldn’t need any code to get clock out working; while in any script, go to params > clock > and route “midi out” to whichever device you want. that’s not working on my end, but
it may work for you!