Hey, anyone know a good way in pd vanilla to check a number stream against a list, and output a bang if the number is in the list?
I've used awful, brute-force solutions to this problem with tons of [sel] objects and message boxes, but these are messy and inflexible. It's a simple challenge logically, so I'm hoping there's a better solution.
My brute force solution (only one [sel] object shown, but in reality there would be one [sel] for each [$n]:
[float] [list] \ / | \ \ [$1][$2][$3] (etc., *n) | \ | / [sel (*n) ]
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.