Recipes
Copy/paste starting points for common MIDI transforms.
Transpose up an octave
neuroscript
transpose +12
passlua
if event.type == "noteOn" or event.type == "noteOff" then
event.data1 = MIDI.clamp(event.data1 + 12)
end
return eventDrop notes below middle C
neuroscript
drop note where note < 60
passlua
if event.type == "noteOn" and event.data1 < 60 then
return {}
end
return eventRemap channel 1 → 2
neuroscript
when ch == 1 {
ch -> 2
}
passlua
if event.channel == 0 then
event.channel = 1
end
return eventVelocity clamp (40-100)
neuroscript
vel clamp 40..100
passlua
if event.type == "noteOn" then
event.data2 = math.max(40, math.min(100, event.data2))
end
return eventRoute high velocity notes to different channel
neuroscript
when type == note_on and vel > 100 {
ch -> 10
}
passlua
if event.type == "noteOn" and event.data2 > 100 then
event.channel = 9 -- MIDI channel 10
end
return eventDelay notes by 100ms
neuroscript
after 100ms {
pass
}lua
-- Lua scheduling requires event queue system
-- See Lua API documentationEvery 4th note to channel 2
neuroscript
when type == note_on {
counter("every4") + 1 -> counter("every4")
when counter("every4") % 4 == 0 {
ch -> 2
}
}
passlua
local function every4th()
context.noteCount = (context.noteCount or 0) + 1
if context.noteCount % 4 == 0 then
event.channel = 1
end
return event
end
if event.type == "noteOn" then
return every4th()
end
return eventMap sustain pedal (CC64) to mod wheel (CC1)
neuroscript
when type == cc and cc == 64 {
emit.cc(1, value)
drop
}
passlua
if event.type == "cc" and event.data1 == 64 then
return {
type = "cc",
channel = event.channel,
data1 = 1,
data2 = event.data2
}
end
return eventVelocity curve (boost soft notes)
neuroscript
when type == note_on and vel < 64 {
vel + 20 -> vel
vel clamp 1..127
}
passlua
if event.type == "noteOn" and event.data2 < 64 then
event.data2 = math.min(127, event.data2 + 20)
end
return eventLearn More
- NeuroScript Language Reference — Complete syntax guide
- Lua API — Alternative scripting option
- Event Model — MIDI event structure
