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.
i have a midi filter block in the rackspace too, is there a way to tell it to block note messages? are its parameters changeable by scripting? if i could tell it to block note messages when newValue==0, that would work, right?
var cm : PitchBendMessage
M : MidiInBlock
Slider1 : Widget //footcontroller vol pedal sending cc7 to VI
filter : PluginBlock //MIDI filter
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
SetParameter (filter, 4, 1)
else SetParameter (filter, 4, 0)
end
end
thanks, paul and david!
however, on getting this working, i found a problem in my concept…need to rethink what i want to do.
that was part of the problem, i fixed that by just blocking note on events instead of all note events…
the other thing was that i wanted i some cases to prepare notes with the volume off, so it didn’t work to always block notes with the volume at 0. fixed that by having a switch on my pedalboard to turn notes off, instead of the volume widget at 0.