<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>One thing that would make a lot of sense is to make the [key] object only output keydown and keyup events, and not output the auto-generated repeats.</div><div><br></div><div>.hc</div><br><div><div>On Sep 28, 2010, at 1:51 AM, tim vets wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>2010/9/28 Ivica Ico Bukvic <span dir="ltr">&lt;<a href="mailto:ico@vt.edu">ico@vt.edu</a>&gt;</span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div lang="EN-US" link="blue" vlink="blue"> <div><p class="MsoNormal"><font size="2" face="Century Gothic"><span style="font-size:10.0pt;font-family:&quot;Century Gothic&quot;">What is the range of the graph? How many hits is your graph showing?</span></font></p><div><font size="2" face="Century Gothic"><span style="font-size:10.0pt;font-family:&quot;Century Gothic&quot;">&nbsp;</span></font><br class="webkit-block-placeholder"></div></div></div></blockquote><div><br></div><div>if you're talking about my graph:</div> <div>the actual keyboard autorepeat rate here is at about 30 ms</div><div>with these mysterious regularly alternating highs and lows.</div><div>The other peaks in the graph are just where I released a key for a while to choose another test key to hold down.</div> <div>arrow keys show a different result than, say, a letter key...</div><div>(test done here on "Ubuntu 8.04&nbsp;- the Hardy Heron",&nbsp;Pd version 0.41.4-extended)</div><div>gr,</div><div>Tim</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div lang="EN-US" link="blue" vlink="blue"><div><p class="MsoNormal"><font size="2" face="Century Gothic"><span style="font-size:10.0pt;font-family:&quot;Century Gothic&quot;">Would this perhaps warrant a small adjustment to Linux code where it checks whether the key of certain type has been outputted in this update and if so, discard repeated occurrence?</span></font></p><p class="MsoNormal"><font class="Apple-style-span" face="'Century Gothic'"><br></font></p><p class="MsoNormal"><font size="2" face="Century Gothic"><span style="font-size:10.0pt;font-family:&quot;Century Gothic&quot;">Best wishes,</span></font></p><div><font size="2" face="Century Gothic"><span style="font-size:10.0pt;font-family:&quot;Century Gothic&quot;">&nbsp;</span></font><br class="webkit-block-placeholder"></div><p class="MsoNormal"><font size="2" face="Century Gothic"><span style="font-size:10.0pt;font-family:&quot;Century Gothic&quot;">Ico</span></font></p><div><font size="2" face="Century Gothic"><span style="font-size:10.0pt;font-family:&quot;Century Gothic&quot;">&nbsp;</span></font><br class="webkit-block-placeholder"></div> <div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"> <div> <div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <hr size="2" width="100%" align="center"> </span></font></div><p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> tim vets [mailto:<a href="mailto:timvets@gmail.com" target="_blank">timvets@gmail.com</a>] <br> <b><span style="font-weight:bold">Sent:</span></b> Monday, September 27, 2010 1:21 PM<br> <b><span style="font-weight:bold">To:</span></b> Ivica Ico Bukvic<br> <b><span style="font-weight:bold">Cc:</span></b> <a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a>; <a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a>; <a href="mailto:pd-dev@iem.at" target="_blank">pd-dev@iem.at</a><br> <b><span style="font-weight:bold">Subject:</span></b> Re: [PD] [PD-dev] odd key object behavior under Linux</span></font></p> </div><div><div></div><div class="h5"><div><font size="3" face="Times New Roman"><span style="font-size:12.0pt">&nbsp;</span></font><br class="webkit-block-placeholder"></div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">I got curious, so I did this little test with auto-repeated keys:</span></font></p> <div><p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><span>&lt;image001.jpg&gt;</span></span></font></p> </div> <div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">strange indeed :)</span></font></p> </div> <div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">gr,</span></font></p> </div> <div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Tim</span></font></p> </div> <div><div><font size="3" face="Times New Roman"><span style="font-size:12.0pt">&nbsp;</span></font><br class="webkit-block-placeholder"></div> </div> <div><div><font size="3" face="Times New Roman"><span style="font-size:12.0pt">&nbsp;</span></font><br class="webkit-block-placeholder"></div> <div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">2010/9/27 Ivica Ico Bukvic &lt;<a href="mailto:ico@vt.edu" target="_blank">ico@vt.edu</a>&gt;</span></font></p><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Many thanks for the explanation! What seems weird, however, is how divergent time delta between repeats is. On Windows it is always around 30ms (at least on my hardware) whereas on Linux it goes between 0, including 1.4ms and up to 50+. Even when accounting for jitter between two events I cannot imagine that they oscillate that much (unless my flavor of kernel/hardware treats keypress timing like a dirt :-).<br> <br> Best wishes,<br> <font color="#888888"><span style="color:#888888"><br> Ico</span></font></span></font></p> <div> <div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br> <a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a> wrote:<br> <br> &gt;<br> &gt;It probably happens when you get two keydowns in the space of one Pd event loop. The second is output at the same time. The same thing happens with [metro] banging serial data into [comport] or [midiout]. The metro rate is quantized to the event loop rate, so individual bangs are irregularly spaced but the mean time over many bangs is perfect. The only way to get perfect timing is to use signals, messages are always handled after the sound has been computed.<br> &gt;So if you don't like it you could slow down your keyboard repeat rate to slower than Pd, or use a microphone to detect the keypresses ;)<br> &gt;<br> &gt;Martin<br> &gt;<br> &gt;<br> &gt;<br> &gt;<br> &gt;Ico wrote:<br> &gt;<br> &gt;&gt; It all started when I noticed that my threaded version of coll object<br> &gt;&gt; tended to freeze Pd at apparently random points. As it turns out, I was<br> &gt;&gt; testing its robustness simply by passing a key into a read/write message<br> &gt;&gt; and holding the key down to generate a large number of requests per<br> &gt;&gt; second and the [key] object at times seemed to spit out (while<br> &gt;&gt; autorepeat of the pressed key was taking place) two outputs at the same<br> &gt;&gt; time which in turn crashed Pd as threaded coll object did not handle<br> &gt;&gt; this gracefully. I've since fixed the coll object but the key behavior<br> &gt;&gt; baffles me.<br> &gt;&gt;<br> &gt;&gt; The double redundant output is apparent in both rt and non-rt Pd (on<br> &gt;&gt; Ubuntu 9.10 using rt kernel on the MSI Wind atom netbook) and below is<br> &gt;&gt; the simplest patch to invoke this.<br> &gt;&gt;<br> &gt;&gt; Basically, I am measuring the aforesaid time delta between broadcast<br> &gt;&gt; strokes using timer object and printing it out to console.<br> &gt;&gt;<br> &gt;&gt; #N canvas 549 345 383 297 10;<br> &gt;&gt; #X obj 162 83 key;<br> &gt;&gt; #X obj 162 107 sel 32;<br> &gt;&gt; #X text 208 108 space;<br> &gt;&gt; #X obj 162 145 timer;<br> &gt;&gt; #X obj 162 182 print;<br> &gt;&gt; #X connect 0 0 1 0;<br> &gt;&gt; #X connect 1 0 3 1;<br> &gt;&gt; #X connect 1 0 3 0;<br> &gt;&gt; #X connect 3 0 4 0;<br> &gt;&gt;<br> &gt;&gt; So, while certainly the fact that threaded version of coll wasn't<br> &gt;&gt; handling gracefully multiple redundant requests at the same time was a<br> &gt;&gt; bug (which I am hoping has been fixed now), I am wondering whether the<br> &gt;&gt; aforesaid [key] behavior might be a bug as it seems to me that<br> &gt;&gt; keystrokes of the same key, even if the key is autorepeating should<br> &gt;&gt; never have a time delta of zero. Naturally, one can always put a<br> &gt;&gt; speedlim after the [key] object but that might result in a truncated<br> &gt;&gt; output of fast typing.<br> &gt;&gt;<br> &gt;&gt; I would greatly appreciate it if others can test this to see if they are<br> &gt;&gt; getting the same results.<br> &gt;&gt;<br> &gt;&gt; FWIW, allowing this kind of key behavior in more complex patches did<br> &gt;&gt; result in the pd&lt;-&gt;gui communication tearing with the stderr reporting<br> &gt;&gt; several truncated messages before crashing. Due to their complexity and<br> &gt;&gt; unpredictability of a point where tearing would occur I am not sure<br> &gt;&gt; where the problem might be stemming from but it is undoubtedly at least<br> &gt;&gt; in part instigated by double redundant output from the key object<br> &gt;&gt; possibly in conjunction with objects that may have not provided graceful<br> &gt;&gt; handling of such requests.<br> &gt;&gt;<br> &gt;&gt; NB: I only tested the same patch on Win platform and there it does not<br> &gt;&gt; exhibit this problem.<br> &gt;&gt;<br> &gt;&gt; Any thoughts would be most appreciated.<br> &gt;&gt;<br> &gt;&gt; Best wishes,<br> &gt;&gt;<br> &gt;&gt; Ico<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; _______________________________________________<br> &gt;&gt; Pd-dev mailing list<br> &gt;&gt; <a href="mailto:Pd-dev@iem.at" target="_blank">Pd-dev@iem.at</a><br> &gt;&gt; <a href="http://lists.puredata.info/listinfo/pd-dev" target="_blank">http://lists.puredata.info/listinfo/pd-dev</a><br> &gt;<br> _______________________________________________<br> <a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br> UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a></span></font></p> </div> </div> </div><div><font size="3" face="Times New Roman"><span style="font-size:12.0pt">&nbsp;</span></font><br class="webkit-block-placeholder"></div> </div> </div></div></div> </div> </div> </blockquote></div><br> <span>&lt;keystroketester.pd&gt;</span>_______________________________________________<br><a href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br></blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><br class="Apple-interchange-newline"><div><br class="khtml-block-placeholder"></div><div><br></div><div>----------------------------------------------------------------------------<br></div><div><br class="khtml-block-placeholder"></div><div>&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;kill your television</div><br class="Apple-interchange-newline"></div></span> </div><br></body></html>