Drum Machine!
I am trying to make a patch which takes the amount of keys pressed down (3 being the maximum) and get it to trigger a different sample (sfplay~ object) the aim is to have each one trigger a different one which I will use a gain object to change the velocity.
The problem I am seeming to have is when I press down on the keys, it plays both the 1 (one key pressed down) and the 2 (two keys pressed down) rather than just for example, the 2. Is there any way I can get around this?
What's the point of summing the number of pressed keys rather than just checking which key is pressed? In both cases it requires three keys to drive three samples.
The problem with the number of pressed keys is that computers work serially. It means that you will never be able to say "I've pushed two keys at the same time". The computer will first register the first key press, then the second.
There are ways to simulate the behavior you want however. For example, start a delay once a key is pressed. Any other key pressed within this delay are considered "at the same time", but it will add a small latency between the first key press and the sample start.
Thanks! This helps more then you know!