<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Batang;
        panose-1:2 3 6 0 0 1 1 1 1 1;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Century Gothic";
        panose-1:2 11 5 2 2 2 2 2 2 4;}
@font-face
        {font-family:"\@Batang";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Century Gothic";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue style='word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><font size=2 face="Century Gothic"><span style='font-size:
10.0pt;font-family:"Century Gothic"'>Indeed. However, does Linux&#8217;s API
allow for this? <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Century Gothic"><span style='font-size:
10.0pt;font-family:"Century Gothic"'><o:p>&nbsp;</o:p></span></font></p>

<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 tabindex=-1>

</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'> Hans-Christoph
Steiner [mailto:hans@at.or.at] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Sunday, October 10, 2010
6:26 PM<br>
<b><span style='font-weight:bold'>To:</span></b> tim vets<br>
<b><span style='font-weight:bold'>Cc:</span></b> Ivica Ico Bukvic;
pd-list@iem.at; martin.peach@sympatico.ca; pd-dev@iem.at<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [PD] [PD-dev] odd key
object behavior under Linux</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>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.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>.hc<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Sep 28, 2010, at 1:51 AM, tim vets wrote:<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br>
<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
2010/9/28 Ivica Ico Bukvic &lt;<a href="mailto:ico@vt.edu">ico@vt.edu</a>&gt;<o:p></o:p></span></font></p>

<div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>

<div link=blue vlink=blue>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face="Century Gothic"><span style='font-size:10.0pt;font-family:"Century Gothic"'>What
is the range of the graph? How many hits is your graph showing?</span></font><o:p></o:p></p>

<div>

<p class=MsoNormal><font size=2 face="Century Gothic"><span style='font-size:
10.0pt;font-family:"Century Gothic"'>&nbsp;</span></font><o:p></o:p></p>

</div>

</div>

</div>

</blockquote>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>if you're talking about my graph:<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>the actual keyboard autorepeat rate here is at about 30 ms<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>with these mysterious regularly alternating highs and lows.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>The other peaks in the graph are just where I released a key for a
while to choose another test key to hold down.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>arrow keys show a different result than, say, a letter key...<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>(test done here on &quot;Ubuntu 8.04&nbsp;- the Hardy
Heron&quot;,&nbsp;Pd version 0.41.4-extended)<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>gr,<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Tim<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>

<div link=blue vlink=blue>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face="Century Gothic"><span style='font-size:10.0pt;font-family:"Century Gothic"'>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><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face="Century Gothic"><span style='font-size:10.0pt;font-family:"Century Gothic"'>Best
wishes,</span></font><o:p></o:p></p>

<div>

<p class=MsoNormal><font size=2 face="Century Gothic"><span style='font-size:
10.0pt;font-family:"Century Gothic"'>&nbsp;</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face="Century Gothic"><span style='font-size:10.0pt;font-family:"Century Gothic"'>Ico</span></font><o:p></o:p></p>

<div>

<p class=MsoNormal><font size=2 face="Century Gothic"><span style='font-size:
10.0pt;font-family:"Century Gothic"'>&nbsp;</span></font><o:p></o:p></p>

</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 style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p>

</div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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:<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>&lt;image001.jpg&gt;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>strange indeed :)<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>gr,<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>Tim<o:p></o:p></span></font></p>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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;<o:p></o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></span></font></p>

<div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></span></font></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</blockquote>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
&lt;keystroketester.pd&gt;_______________________________________________<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><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div><span style='border-spacing: 0px 0px;text-align:auto;-khtml-text-decorations-in-effect: none;
-apple-text-size-adjust: auto;orphans: 2;widows: 2;word-spacing:0px'>

<div style='word-wrap: break-word;-khtml-nbsp-mode: space;-khtml-line-break: after-white-space'>

<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'>----------------------------------------------------------------------------<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'>&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;kill your television<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o:p></span></font></p>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'></span><o:p>&nbsp;</o:p></span></font></p>

</div>

</div>

</body>

</html>