i am trying to block midi notes from reaching a VI when my volume pedal is at “0”. there is a midi filter block in the rackspace, but i can’t figure out how to tell it to switch cc7 from blocked to unblocked and back…so, i thought i’d intercept the notes and send a note with volume 0 instead - is there a way to just intercept the notes, i.e. have an “On NoteEvent” callback with no action specified, that just stops the notes? anyway, here’s what i am trying (the pitch bend stuff is just to make sure there are no lingering string bending/pitch issues, my controller is a guitar…):
var cm : PitchBendMessage M : MidiInBlock Slider1 : Widget null : MidiMessage initialization null = MakeNoteMessage(C3, 0) end on NoteOffEvent(m : NoteMessage) from M cm := MakePitchBendMessage(8192) SendNow(M, cm) SendNow(M, m) // send Note Off end On WidgetValueChanged(newValue : double) from Slider1 if newValue = 0 then on NoteEvent(m : NoteMessage) from M SendNow (M, null) end end end
i am getting a syntax error after the OnWidgetValueChanged callback, it says
Unexpected or unrecognized token: ‘if’
Mismatched input ‘if’ expecting End
i don’t understand this. this kind of construction complies in other scripts.