[PD] Key-repeat makes keyboard-pianokeys impossible?

Mathieu Bouchard matju at artengine.ca
Tue Jul 18 02:15:22 CEST 2006


On Tue, 18 Jul 2006, Roman Haefeli wrote:

> when now a key is pressed over a long period, it outputs alternating 
> ones and zeros (1....01..01..01..01..01..01..01..01..01..0). the 
> insteresting thing here is that, if a key is hold down, the logical time 
> between the [0( and the following [1( is 0ms. this means you could just 
> ignore all 0/1-pairs, if the time between them is 0ms. since you 
> normally don't want to trigger the same note in 0ms time, this methode 
> won't introduce any unwanted delays.

That's what I mean about X11 timestamps. What you add to what I say, that 
I didn't try and didn't know, is that due to characteristics of X11, 
UNIX-sockets, Tk, u_main.tk, s_inter.c and a few other things, the logical 
delay will be 0ms almost all of the time. I can foresee that it can be 
non-0ms sometimes, if Pd's client and server are on different machines 
and/or if the X11 client and server are on different machines, due to the 
breaking down of events into packets; I suspect that it may also happen 
when just running on different CPUs, due to different process scheduling; 
however, I don't know how probable those glitches might be. It might only 
happen when transmitting 200 key/mouse events at once, for example, so 
maybe it's too unlikely to consider (depending on your mouse's freq).

> on windows i measured a grid of ca. 11ms, or in other words the time
> between two key-events is a multiple of 11ms. on linux (ubuntu dapper
> without changing any settings) i measured a grid of 85.333ms. is this
> because of my x-settings or is pd on linux polling events only all
> 85.333ms?

Reconfigure your keyboard... mine produces events at every 31 or 32 ms. I 
don't have more precise figures because I use the following Tk program:

   bind all <Key> {puts %t}

where %t is a macro-variable representing time in integer milliseconds.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada


More information about the Pd-list mailing list