oxesoft / keyboardscanner

Turn your broken (or unused) keyboard into a MIDI controller (with pedal and veloticy)
https://www.youtube.com/watch?v=z840N9P-T2k
75 stars 30 forks source link

Using with a keyboard that has a different switch type? #17

Closed lopazopy closed 1 year ago

lopazopy commented 1 year ago

I have an older electric piano and its keys use a switch that is like a single pole double throw (SPDT) configuration. Right now, I'm monitoring when the key closes the circuit that is normally open and getting note information that way. I'd like to add velocity since I have the 2 circuits. I'm just not sure how to monitor the states between the normally closed condition and the normally open position and the timing it takes to get there. Any ideas how I could modify this code to fit my situation? Thanks.

SPDT

oxesoft commented 1 year ago

Besides following the common instructions, you need to modify the for block at line 420 to consider just the start time when the key is opened. This is the only difference, in your case. You might need to modify MIN_TIME_MS and MAX_TIME_MS to better response for your keys.