I have a sustain pedal that has a 3,5 phono jack for controls and I'd like to know if it were possible to somehow add a pedal like this into my hypothetical Samplerbox. It won't connect to my MIDI keyboard and previously was plugged into my yamaha sound generator.
(If the question has been answered somewhere else, please redirect - noob here, haven't been browsing this site for long)
This is definitely possible, but will require a bit of hacking and soldering. First thought is that you'd want to be connecting a 3.5 female jack to the RPi's GPIO and treat it like an on/off button. Then in
samplerbox.py you'd need to assign those GPIO pins to the sustain function.
hmmm, my five cents:
Maybe it's no issue anymore (I was using a PI-2 back then):
I noticed timing issues (=noise) when using the gpio for the external buttons during audio output. I concluded that reading gpio in independent thread causes hw-waits. But I did not go into that deep enough to be sure. After all: you don't use those buttons when playing.
So possibly it can be avoided by coding the GPIO/button thread in another way or tune the proc better.
The easy bypass: just reading the pins in the midi callback will not work properly as this callback is entered only when a midi signal is received. So you may see the sustain change too late.
Sorry, last part of the answer re the bypass is confusing.
All sustainpedal processing needs to be transferred to the button or new gpio thread anyway, forget about bypasses via a separate and independent process.