On 9 March 2010 11:10, Matt B. <matthew.biddle@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.