<br><br><div class="gmail_quote">On 9 March 2010 11:10, Matt B. <span dir="ltr"><<a href="mailto:matthew.biddle@gmail.com">matthew.biddle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey guys<br>
<br></blockquote><div><br></div><div>Ey, Matt.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I'm trying to do a simple chuckle, but something's going wrong when I<br>
try to set s.freq...<br>
<br>
SinOsc s=>dac;Phasor<br>
p=>blackhole;p.freq(2);while(1){Math.sqrt(1/p.last())*100=>s.freq;10::ms=>now;};<br>
<br></blockquote><div><br></div><div>Working towards a tweet? :-)</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If I dump "Math.sqrt(1/p.last())*100" I get floating values as<br>
expected between 100 and 700, but when I chuck it to s.freq, no sound<br>
is output, and s.last() is always 0.<br>
<br>
Am I missing something or is this a bug?<br></blockquote><div><br></div><div>There is a bug here, I think. The as p.last() may be 0 (and will be when we start) the result will be infinity, or "nan" or some such thing. For reasons unknown this doesn't get through to the print yet still gets the UGen stuck. UGens do not like floats that aren't numbers, in my experience.</div>
<div><br></div><div>Here is a version that works (with indentation, if you don't mind);</div><div><br></div><div><div><br></div><div>SinOsc s => dac;</div><div>Phasor p=>blackhole;</div><div><br></div><div>p.freq(2);</div>
<div><br></div><div> while(1)</div><div>  {</div><div>  Math.sqrt(1/ ( p.last() + 0.0000001 )) * 100=>s.freq;</div><div>  10::ms=>now;</div><div>  }</div><div><br></div></div><div>As there was still some coffee left after finding the issue (interesting bug! and cool sound) I also made a remix.</div>
<div><br></div><div><div><br></div><div>SinOsc s => dac;Phasor</div><div>p=>blackhole;</div><div><br></div><div><br></div><div>fun void add()</div><div>    {</div><div>    int foo;</div><div>    while (4::second => now)++foo%16 => p.freq;</div>
<div>    }</div><div><br></div><div>spork ~ add();</div><div><br></div><div> while(1)</div><div>  {</div><div>  Math.sqrt(1/ ( p.last() + 0.0000001 )) * 100=>s.freq;</div><div>  10::ms=>now;</div><div>  }</div><div>
<br></div><div><br></div><div>Yours,</div><div>Kas.</div></div></div>