Hi,
when I hold down a key on the computer keyboard, the left outlet of [keyname] object rapidly oscillates between 0 and 1. Why doesn't it stay stable at 1?
It should return to 0 only when the key is released...

keyname_1.pd
Thank you,
a.
- 
				
				
				
				[keyname] question 
 
- 
				
				
				
				@atux Could you imagine typing jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj if you had to hit 'j' every single time? Would be rather tedious. Computer keyboards repeat when a key is held down which is defined by the system and pd respects. 
- 
				
				
				
				@oid said: @atux Could you imagine typing jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj if you had to hit 'j' every single time? Would be rather tedious. Computer keyboards repeat when a key is held down which is defined by the system and pd respects. So I have to find a way for it to stay on 1 until the key is released. 
 [I thought that object simulated the key of a midi keyboard, at least in terms of note-on and note-off]
 Thank you,
 a.
- 
				
				
				
				@atux You can disable autorepeat system wide, on linux you can use xset r offwhich you can do from pd using [command] or from a terminal. It makes the patch simpler but less portable since every OS has a different way to handle this. [else/keymap] does it all in pd and turns your keyboard into a midi keyboard, not suitable for all situations but it is an abstraction so you can just open it up and see how it works/change it to meet your needs.
- 
				
				
				
				@oid said: [else/keymap] [else/keymap] works fine, but occasionally gets stuck at 127 (doesn't go back to 0) a. 
- 
				
				
				
				@atux I made this a while ago....... key-debounce.zip 
 It deals with many key problems that should not really need to be solved...... e.g. repeats when you hold down 2 or more keys...... which cannot be solved using [change].... https://forum.pdpatchrepo.info/topic/12540/help-with-key-keyup-inside-clone/4
 You might need to change it slightly to use [keyname] by connecting the left outlet of [keyname] instead of the outlet of [key] which is used in the help file.
 I hope it solves your problem.
 David.
- 
				
				
				
				@atux said: [else/keymap] works fine, but occasionally gets stuck at 127 (doesn't go back to 0) please report a bug then  
- 
				
				
				
				Here is the way I did it using key and keyup 
 However filtering key numbers may vary with different keyboard layouts
 computer-keys-to-notes.zip
 
					 
									 
									