there may be a default parameter, right? And that seems to be 0. If I have sync at "0", I hear no sound.


I think "sync" is a poor keyword for this method. It has nothing to do with hard sync. Instead, it determines what to do with a UGen connected to its input.

This:
SinOsc a => SinOsc b => dac;
0 => b.sync; // the default

results in no audio because ChucK is attempting to use the output of SinOsc a (which is of course a stream between -1 and 1) and using those values as the frequency parameter for SinOsc b. In other words, SinOsc b is playing at a frequency between -1 and 1.

Here's a demonstration of how sync 0 can work:

Phasor p => SinOsc b => dac;
1 => p.freq;
1000 => p.gain;
0.25 => b.gain;
4::second => now;

Anyway, it doesn't seem like the sync parameter is able to do hard sync. It seemed that the "0" value would do that, but, as I said, I hear nothing.


I think you're right; to do hard sync you have to manually check the Phasor and reset the oscillator phase. BTW, according to the source code, the .phase method ranges from [0-1).

Phasor p => blackhole;
SinOsc s => dac;
0.2 => s.gain;
440 => s.freq;
1 => p.freq;

spork~ hardsync();

while (true)
{
 second => now;
 p.freq() + 1 => p.freq;
}

fun void hardsync()
{
  float prev;
  while (true)
  {
      p.last() => float last;
      if (last < prev) 0 => s.phase;
      last => prev;
      samp => now;
  }
}



If phase input is linear in chuck, then the code from SuperCollider would be equivalent, but it is not. And even if it wasn't linear, I tried it with radian values and did not get the same results.

I suspect it is not really doing phase modulation because it doesn't matter if I change the carrier frequency, and that is weird.

well, I guess I'm repeating myself, sorry, just anxious in the hope of clarification.

thanks


_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users