[chuck-users] sinosc and phase_offset

Ge Wang gewang at CS.Princeton.EDU
Sun Dec 18 03:38:03 EST 2005


Hi Micha and all,

> 60 => std.mtof => float freq;
> sinosc m1 => sinosc c1 => dac;
> freq => m1.sfreq;
> freq => c1.sfreq;
>
> while (1)
> {
>     m1.last() => c1.phase_offset;
>     1::samp => now;
> }
>
> causes this error:
>
> operation failed (sorry)...(reason: line(10): class 'sinosc' has no 
> member 'phase_offset')

Yikes.  phase_offset has been removed since 1.2.0.0 but the 
documentation still says it exists.  I have changed it on the web - 
Adam, can you update it in the manual as well, when you have time?

As for the code above, try using .phase instead of .phase_offset.  
(alternately, one can also use the blackhole to drive 'm1').

60 => std.mtof => float freq;
sinosc m1 => blackhole;
sinosc c1 => dac;
freq => m1.sfreq;

while (1)
{
     m1.last() => c1.phase;
     1::samp => now;
}

---

Also (assuming I understand the intention of the code correctly), you 
can use .sync to synchronize the phase to the input in this particular 
case.

60 => std.mtof => float freq;
sinosc m1 => sinosc c1 => dac;
freq => m1.sfreq;
// set to synch phase using input
2 => c1.sync;

// no additional control is needed in the time loop
while (1) { 1::day => now; }

I hope this helps.

Best,
Ge!



More information about the chuck-users mailing list