When a friend donated a Korg PA300 keyboard (I think it was) to one of my VPO projects, I happily accepted since, although the synthesizer was dead, the MIDI Out still functioned. It was a fine keyboard, but then the MIDI died. I opened it up and noted that the keys were mounted on a sturdy metal frame and had real contacts; none of this rubber dimple stuff! This was worth salvaging.
I extracted it from its massive metal cocoon and divested it of all electronics. The Korg has two contacts under each key. The first one encountered, as the key is depressed, is normally closed whereas the second is normally open. The Korg of course was programmed to use these to determine the velocity with which the note is struck. I had another idea.
This setup is ideal for "time-of-flight" debouncing. Here is how it works. When the key is depressed and closes the second, NO switch, the note is turned on, unless it is already on. Upon release the NC top switch closes again. This time the note is turned off, unless it is already off. Simple; and the response feels right (and no bounce).
The contacts are arranged in a 12 x (5 + 5) matrix. Although usually top C is treated as the odd man out, in the Korg it is bottom C. On page four of my website you will find the code (an elided version) that does the scanning. You'll see that it is quite different from the code for my Galanti project (pages 2 and 3)
https://sites.google.com/site/casavantopus400/home
In Praise of Linear Code:
When you look at the code, you'll see that it is the code for one note repeated five times and that block of code, in turn, is repeated twelve times. Professional programmers will denounce this as inelegant and insist that I restructure this as two tightly nested loops.
But let me make my case. The pin order for the notes and octave lines was a bit screwy and with "cut and paste" it was easy enough to replicate the code and then edit in the correct parameters. The result is easy to read and understand. Debugging is a breeze. Beginning programmers should not hesitate to use linear code if that helps them understand what is going on. There is nothing wrong with linear code! Yes it takes up more memory, but with a dedicated Arduino, who cares. And, because the program is not managing loop counters and doing comparisons, linear code should run slightly faster. But again, who cares. It's your VPO, program it as you wish.
Someday soon, I hope to use the Korg as part of a MIDI front end for a small pipe organ.
John
I extracted it from its massive metal cocoon and divested it of all electronics. The Korg has two contacts under each key. The first one encountered, as the key is depressed, is normally closed whereas the second is normally open. The Korg of course was programmed to use these to determine the velocity with which the note is struck. I had another idea.
This setup is ideal for "time-of-flight" debouncing. Here is how it works. When the key is depressed and closes the second, NO switch, the note is turned on, unless it is already on. Upon release the NC top switch closes again. This time the note is turned off, unless it is already off. Simple; and the response feels right (and no bounce).
The contacts are arranged in a 12 x (5 + 5) matrix. Although usually top C is treated as the odd man out, in the Korg it is bottom C. On page four of my website you will find the code (an elided version) that does the scanning. You'll see that it is quite different from the code for my Galanti project (pages 2 and 3)
https://sites.google.com/site/casavantopus400/home
In Praise of Linear Code:
When you look at the code, you'll see that it is the code for one note repeated five times and that block of code, in turn, is repeated twelve times. Professional programmers will denounce this as inelegant and insist that I restructure this as two tightly nested loops.
But let me make my case. The pin order for the notes and octave lines was a bit screwy and with "cut and paste" it was easy enough to replicate the code and then edit in the correct parameters. The result is easy to read and understand. Debugging is a breeze. Beginning programmers should not hesitate to use linear code if that helps them understand what is going on. There is nothing wrong with linear code! Yes it takes up more memory, but with a dedicated Arduino, who cares. And, because the program is not managing loop counters and doing comparisons, linear code should run slightly faster. But again, who cares. It's your VPO, program it as you wish.
Someday soon, I hope to use the Korg as part of a MIDI front end for a small pipe organ.
John