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

Kassen signal.automatique at gmail.com
Tue Mar 9 06:37:06 EST 2010


On 9 March 2010 12:21, Matt B. <matthew.biddle at gmail.com> wrote:

> Cool, so I wasn't going crazy!
>

No, but it would be good to get into the habit of making sure divisions are
never by zero.
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.


> 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. And good luck.

Kas.


> 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
> >
> >
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100309/2c77cb4f/attachment.html>


More information about the chuck-users mailing list