<br><br><div class="gmail_quote">On 9 March 2010 12:21, 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;">
Cool, so I wasn't going crazy!<br></blockquote><div><br></div><div>No, but it would be good to get into the habit of making sure divisions are never by zero.</div><div>I do feel that it would be a good idea to have UGens make sure they don't get stuck at receiving a "nan" as I think quite a few do.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Yeah, I was inspired by the one-liners thread on the electro-music<br>
forums. I was aiming at a concise little four on the floor... Cool<br>
remix :)<br>
<br></blockquote><div>Thanks. And good luck.</div><div><br></div><div>Kas.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thanks for the help.<br>
<br>
2010/3/9 Kassen <<a href="mailto:signal.automatique@gmail.com">signal.automatique@gmail.com</a>>:<br>
<div><div></div><div class="h5">><br>
><br>
> On 9 March 2010 11:10, Matt B. <<a href="mailto:matthew.biddle@gmail.com">matthew.biddle@gmail.com</a>> wrote:<br>
>><br>
>> Hey guys<br>
>><br>
><br>
> Ey, Matt.<br>
><br>
>><br>
>> 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>
>><br>
>> p=>blackhole;p.freq(2);while(1){Math.sqrt(1/p.last())*100=>s.freq;10::ms=>now;};<br>
>><br>
><br>
> Working towards a tweet? :-)<br>
><br>
>><br>
>> 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>
><br>
> There is a bug here, I think. The as p.last() may be 0 (and will be when we<br>
> start) the result will be infinity, or "nan" or some such thing. For reasons<br>
> unknown this doesn't get through to the print yet still gets the UGen stuck.<br>
> UGens do not like floats that aren't numbers, in my experience.<br>
> Here is a version that works (with indentation, if you don't mind);<br>
><br>
> SinOsc s => dac;<br>
> Phasor p=>blackhole;<br>
> p.freq(2);<br>
>  while(1)<br>
>   {<br>
>   Math.sqrt(1/ ( p.last() + 0.0000001 )) * 100=>s.freq;<br>
>   10::ms=>now;<br>
>   }<br>
> As there was still some coffee left after finding the issue (interesting<br>
> bug! and cool sound) I also made a remix.<br>
><br>
> SinOsc s => dac;Phasor<br>
> p=>blackhole;<br>
><br>
> fun void add()<br>
>     {<br>
>     int foo;<br>
>     while (4::second => now)++foo%16 => p.freq;<br>
>     }<br>
> spork ~ add();<br>
>  while(1)<br>
>   {<br>
>   Math.sqrt(1/ ( p.last() + 0.0000001 )) * 100=>s.freq;<br>
>   10::ms=>now;<br>
>   }<br>
><br>
> Yours,<br>
> Kas.<br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> chuck-users mailing list<br>
> <a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
> <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
><br>
><br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</div></div></blockquote></div><br>