Created
May 30, 2024 08:15
-
-
Save Zazcallabah/a0c67cf5a6c4427c3e4fbca817f1525b to your computer and use it in GitHub Desktop.
sendmidi norns shield
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SendMidi | |
s = require 'sequins' | |
m = midi.connect() | |
m.event = function(data) | |
local d = midi.to_msg(data) | |
print("ch:" .. d.ch .. " cc:" .. d.cc .. " val:" .. d.val) | |
end | |
function init() | |
mults = s{ 0, 7, 2, 7, 0, 7, 2, 7, -2, 4, 1, 4, -2, 4, 1, 4 } | |
lastnote = 1 | |
sequence = clock.run( | |
function() | |
on = false | |
while true do | |
clock.sync(1/2) | |
if on then | |
print("off") | |
m:note_off(lastnote ,0,1) | |
else | |
print("on") | |
lastnote = 64 + mults() | |
m:note_on(lastnote,64,1) | |
end | |
on = not on | |
end | |
end | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment