[chuck-users] Why doesn't this work?

Matt B. matthew.biddle at gmail.com
Tue Mar 9 06:21:42 EST 2010


Cool, so I wasn't going crazy!

Yeah, I was inspired by the one-liners thread on the electro-music
forums. I was aiming at a concise little four on the floor... Cool
remix :)

Thanks for the help.

2010/3/9 Kassen <signal.automatique at gmail.com>:
>
>
> On 9 March 2010 11:10, Matt B. <matthew.biddle at gmail.com> wrote:
>>
>> Hey guys
>>
>
> Ey, Matt.
>
>>
>> I'm trying to do a simple chuckle, but something's going wrong when I
>> try to set s.freq...
>>
>> SinOsc s=>dac;Phasor
>>
>> p=>blackhole;p.freq(2);while(1){Math.sqrt(1/p.last())*100=>s.freq;10::ms=>now;};
>>
>
> Working towards a tweet? :-)
>
>>
>> If I dump "Math.sqrt(1/p.last())*100" I get floating values as
>> expected between 100 and 700, but when I chuck it to s.freq, no sound
>> is output, and s.last() is always 0.
>>
>> Am I missing something or is this a bug?
>
> 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.
> Here is a version that works (with indentation, if you don't mind);
>
> SinOsc s => dac;
> Phasor p=>blackhole;
> p.freq(2);
>  while(1)
>   {
>   Math.sqrt(1/ ( p.last() + 0.0000001 )) * 100=>s.freq;
>   10::ms=>now;
>   }
> As there was still some coffee left after finding the issue (interesting
> bug! and cool sound) I also made a remix.
>
> SinOsc s => dac;Phasor
> p=>blackhole;
>
> fun void add()
>     {
>     int foo;
>     while (4::second => now)++foo%16 => p.freq;
>     }
> spork ~ add();
>  while(1)
>   {
>   Math.sqrt(1/ ( p.last() + 0.0000001 )) * 100=>s.freq;
>   10::ms=>now;
>   }
>
> Yours,
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>


More information about the chuck-users mailing list