[sdiy] MIDI velocity
modular at go2.pl
Wed Apr 6 13:56:07 CEST 2016
There are 2 kinds of switches, hence 2 debouncing methods used.
For musical keyboard you need the fastest response, so note-on is sent
on the first touch of the contact, regardless if it's just initial
bounce or solid contact. Debouncing is done on note's tail, so note-off
is sent some time after last time closed contact was detected. That
assumes minimal note duration, so it completely covers initial bounces,
and adds a bit of the tail. Usually that is 10-20ms, which is not
possible to notice on any typically releasing sounds. And you can adjust
that time from no debouncing at all, to about 40ms.
For function keys, like transpoze, channel change, program change and so
on, there's no need for immediate response, so instead, debouncing is
done here on contact closing, not release. also to prevent the function
from appearing if you accidently wipe your hand over the button.
Depending on function I usually add 20 to over 200ms window checking if
contact is closed at each iteration before actual function is invoked.
W dniu 2016-04-06 o 12:45, Richie Burnett pisze:
> Roman wrote:
>> ...regular scanning starts and is repeated until all keys are
> detected released and debounced.
> Out of interest, what rule do you use for the de-bouncing of musical
> instrument keys?
> For general switches in the user-interface of embedded control projects
> I have always used the rule that the switch state must have been stable
> for 10ms before updating the output state. So, whatever action the
> switch causes only takes place after the switch has been in the active
> state without bouncing for 10ms, and then the action variable only
> cancels when the switch has been in the inactive state for 10ms without
> bouncing. This works very well for de-bouncing pushbuttons and toggle
> switches in things like industrial control equipment because it
> inherently rejects any brief glitches due to EMC transients, as well as
> removing the effects of mechanical switch bounce. Nobody notices 10ms
> latency on the start and stop buttons of a CNC machine, or an
> oscilloscope, or whatever it is used for. But for musical keys, or drum
> pads, I am thinking that this 10ms latency on the closing of the switch
> is not acceptable. Maybe I should revise the algorithm to act on the
> first inactive-to-active transition and update the output state to
> active immediately. I would be interested to hear what rule you apply.
More information about the Synth-diy