Skip to content

Recipes

Copy/paste starting points for common MIDI transforms.

Transpose up an octave

neuroscript
transpose +12
pass
lua
if event.type == "noteOn" or event.type == "noteOff" then
  event.data1 = MIDI.clamp(event.data1 + 12)
end
return event

Drop notes below middle C

neuroscript
drop note where note < 60
pass
lua
if event.type == "noteOn" and event.data1 < 60 then
  return {}
end
return event

Remap channel 1 → 2

neuroscript
when ch == 1 {
    ch -> 2
}
pass
lua
if event.channel == 0 then
  event.channel = 1
end
return event

Velocity clamp (40-100)

neuroscript
vel clamp 40..100
pass
lua
if event.type == "noteOn" then
  event.data2 = math.max(40, math.min(100, event.data2))
end
return event

Route high velocity notes to different channel

neuroscript
when type == note_on and vel > 100 {
    ch -> 10
}
pass
lua
if event.type == "noteOn" and event.data2 > 100 then
  event.channel = 9  -- MIDI channel 10
end
return event

Delay notes by 100ms

neuroscript
after 100ms {
    pass
}
lua
-- Lua scheduling requires event queue system
-- See Lua API documentation

Every 4th note to channel 2

neuroscript
when type == note_on {
    counter("every4") + 1 -> counter("every4")
    when counter("every4") % 4 == 0 {
        ch -> 2
    }
}
pass
lua
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 event

Map sustain pedal (CC64) to mod wheel (CC1)

neuroscript
when type == cc and cc == 64 {
    emit.cc(1, value)
    drop
}
pass
lua
if event.type == "cc" and event.data1 == 64 then
  return {
    type = "cc",
    channel = event.channel,
    data1 = 1,
    data2 = event.data2
  }
end
return event

Velocity curve (boost soft notes)

neuroscript
when type == note_on and vel < 64 {
    vel + 20 -> vel
    vel clamp 1..127
}
pass
lua
if event.type == "noteOn" and event.data2 < 64 then
  event.data2 = math.min(127, event.data2 + 20)
end
return event

Learn More

Built with ❤️ for musicians