#N canvas 559 247 891 565 12; #X text 13 13 Abstraction to detect keyboard actions without repeating key presses.; #X obj 154 173 tgl 15 0 empty empty down/up 17 7 0 10 -262144 -1 -1 0 1; #X obj 125 201 bng 15 250 50 0 empty empty should_only_flash_once_on_down_or_up 17 7 0 10 -262144 -1 -1; #X obj 36 420 timer; #X obj 36 394 t b b; #X obj 36 340 key; #X obj 36 366 sel 71; #X obj 36 445 moses 1; #X floatatom 35 474 5 0 0 1 msec - -; #X obj 35 500 print myComputersRepeatRate; #X text 139 339 When you press and hold a key on your computers keyboard \, most operating systems will repeat this keypress automatically \, mimicking old typewriters. This can be an obstacle to detect key-down and key-up reliably. Use the patch to the left to estimate the longest intervall in milliseconds of such repeats while keeping a single key depressed. The first argument of [keyhold] should be slightly larger than this interval.; #X obj 125 146 keyhold 60 G; #X text 460 163 2.argument: Symbol to indicate the key to filter.; #X text 459 90 1.argument: Interval time (msec) to block key repeats. Will vary for different operating systems and its user settings. See patch below for information how to set for your computer.; #X text 26 247 This will detect key downs and ups for capital letter 'G' while blocking key repeats that happen faster than 60msec.; #X text 459 206 BUG: Currently the space bar can not be detected.; #N canvas 511 55 450 300 version-2019-05-01 0; #X text 16 97 Bug/TODO: The symbol for the space bar has different captitals 'space' and 'Space' for down and ups.; #X text 18 31 Expanded from an idea posted by Katja Vetter on the pd mailing list on March 8th 2019; #X restore 710 529 pd version-2019-05-01; #X text 419 530 (c) 2019 Peter P. under the BSD license.; #X text 458 240 NOTE: Most computer keyboards can not detect more than 3-5 keys depressed together.; #X connect 3 0 7 0; #X connect 4 0 3 0; #X connect 4 1 3 1; #X connect 5 0 6 0; #X connect 6 0 4 0; #X connect 7 1 8 0; #X connect 8 0 9 0; #X connect 11 0 1 0; #X connect 11 0 2 0;