Working on sustain pedal functionality for the first time, and running into problems. The attached patch basically filters out noteoffs with [stripnote], and sends them separately if the pedal value is 0. If the pedal value is nonzero (depressed), it stores the noteoffs in the [bag] object and flushes when the pedal value returns to 0.
Unfortunately, some voices are held when they shouldn't be, and I can't really figure out why. The note-offs seem to be sending correctly.
One potential problem is that the udp connection I'm using to get the midi data in is banging all of the outputs with every change -- so, changes in what is originally the [ctlin[ value send repeated bangs to the note and velocity streams. In other words, depressing or releasing the pedal sends bangs through the note-on pathway even though the note and velocity values aren't changing. If that is the problem, how can I remove the bangs from those number streams? the path here leading to [stripnote] should only be banged with a new note, not a pedal change.
Any help would be hugely appreciated! I may be missing something simple and obvious.