awarm.spacenewsletter | fast | slow

Monome Norns

Drum remapper

I wrote this to remap the midi output from my Alesis Nitro Kit into different channels the Elektron Model: Cycles understands:

drums = midi.connect(1)
synth = midi.connect(2)
local note_to_channel = {
[36] = 1,
[46] = 2,
[23] = 2,
[42] = 2,
[44] = 2,
[38] = 3,
[48] = 4,
[45] = 5,
[43] = 6
}
function init()
print('yoooo')
drums.event = handle_midi
end
function handle_midi(data)
msg = midi.to_msg(data)
velocity = data[3]
if msg.type == 'note_on' then
print(note_to_channel[msg.note])
synth:note_on(60, velocity, note_to_channel[msg.note])
end
if msg.type == 'note_off' then
synth:note_off(60, velocity, note_to_channel[msg.note])
end
end