Hmmmmmm, <br><br>we seem to have another bug. The code pasted below (intended to be saved as &quot;<a href="http://xfade.ck">xfade.ck</a>&quot;) is intended to set up a small patch, then reload itself (hopefully in edited form) in a crossfading manner every time the &quot;end&quot; key is pressed. As far as I can see it&#39;s syntactically correct ChucK and the parser agrees with me (both the latest and the last version will try to run this without complaints). However, uppon pressing any key the whole thing will get stuck and it will get stuck so badly that Windows only realises it&#39;s stuck as soon as I try to force it to quit. Moving the definition of the keyboard and it&#39;s message out of the class will crash the whole thing immediately for reasons unkown (namespace?). Moving the whole keyboard reader to it&#39;s own sporked shred outside of the class, then trying to use event signalling to set in the x-fade will also get the whole thing stuck. The issue isn&#39;t in the atempt to have some code 
Machine.add() itself as a condition either.<br><br>I&#39;ve been at this for a few hours now and I&#39;d say this looks quite bad, kicking out everything that involves reading the keyboard (and making the condition time-dependant) fixes it so I suspect there is something inbetween classes and reading the keyboard profoundly wrong.
<br><br>For now I give up, Spencer? Ge?<br><br>Kas.<br><br>
Code pasted below, comments aimed at new users, might prove usefull/fun once we get to the bottom of why it crashes so terribly, stay tuned.<br>==============================================-<br>//construct a &quot;penny&quot;, penny is named after a brand of faders popularly used in DJ mixers
<br>Penny fade;
<br>&nbsp;<br>//realy simple patch to invite editing
<br>SinOsc s =&gt; Gain g =&gt; <a href="http://fade.in">fade.in</a>;
<br>fade.out =&gt; dac;
<br>&nbsp;<br>SinOsc lfo =&gt; g;
<br>//multiplication, i.e. a VCA
<br>3 =&gt; g.op;
<br>&nbsp;<br>second =&gt; lfo.period;
<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>//infinite loop
<br>while(true) second =&gt; now;
<br>&nbsp;<br>&nbsp;<br>class Penny
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //&quot;in&quot; and &quot;out&quot; are simply there for convenience
<br>&nbsp;&nbsp;&nbsp; Gain in =&gt; Envelope fader =&gt; Gain out;
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //edit this to something musical
<br>&nbsp;&nbsp;&nbsp; second =&gt; dur fadeTime;
<br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //fade-in, this happens at the moment the instance is constructed
<br>&nbsp;&nbsp;&nbsp; fadeTime =&gt; fader.duration;
<br>&nbsp;&nbsp;&nbsp; 1 =&gt; fader.keyOn;
<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //create keyboard interface and asociated message
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Hid hi;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; HidMsg msg;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; hi.openKeyboard( 0 );
<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //get the shred ID, needed to kill it later
<br>&nbsp;&nbsp;&nbsp; me.id() =&gt; int myID;
<br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //run keyboard listening in its own shred
<br>&nbsp;&nbsp;&nbsp; spork ~ kb_listener();
<br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; fun void kb_listener()
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while(true)
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; hi =&gt; now;
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //207 refers to the &quot;end&quot; key
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //edit this if you need that key for other purposes
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(msg.isButtonDown() &amp;&amp; ( msg.which == 207)&nbsp; &amp;&amp; Machine.add( &quot;<a href="http://xfade.ck">xfade.ck</a>&quot; ) )
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 1 =&gt; fader.keyOff;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fadeTime =&gt; now;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Machine.remove(myID);
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; }<br>