<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:st1="urn:schemas-microsoft-com:office:smarttags" 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]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @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.EmailStyle17
        {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>

<div class=Section1>

<p class=MsoNormal><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?<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>

<p class=MsoNormal><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?<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>

<p class=MsoNormal><font size=2 face="Century Gothic"><span style='font-size:
10.0pt;font-family:"Century Gothic"'>Best wishes,<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>

<p class=MsoNormal><font size=2 face="Century Gothic"><span style='font-size:
10.0pt;font-family:"Century Gothic"'>Ico<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'> tim vets
[mailto:timvets@gmail.com] <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> martin.peach@sympatico.ca; <st1:PersonName
w:st="on">pd-list@iem.at</st1:PersonName>; 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>

<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:<o:p></o:p></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'><img width=984
height=378 id="_x0000_i1025" src="cid:image001.jpg@01CB5E6F.BDDB2E70"
alt=keytimetest.jpg title=keytimetest.jpg><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'>strange indeed :)<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>

<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'>2010/9/27 Ivica Ico Bukvic &lt;<a href="mailto:ico@vt.edu">ico@vt.edu</a>&gt;<o:p></o:p></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><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'><br>
<a href="mailto:martin.peach@sympatico.ca">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">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">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>

<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>

</div>

</body>

</html>