<div dir="ltr">Thanks joel, it's starting to make sense to me now.<div><br></div><div>I'd suggest more examples in the documentation explaining what this sync parameter is and works so it's clearer</div><div><br></div><div>cheers</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-04 0:53 GMT-03:00 Joel Matthys <span dir="ltr"><<a href="mailto:jwmatthys@gmail.com" target="_blank">jwmatthys@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><span class="">
<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>there may be a default parameter, right? And that seems
to be 0. If I have sync at "0", I hear no sound.</div>
<div><br>
</div>
</div>
</div>
</div>
</blockquote>
<br></span>
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.<br>
<br>
This:<br>
SinOsc a => SinOsc b => dac;<br>
0 => b.sync; // the default<br>
<br>
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.<br>
<br>
Here's a demonstration of how sync 0 can work:<br>
<br>
<tt>Phasor p => SinOsc b => dac;</tt><tt><br>
</tt><tt>1 => p.freq;</tt><tt><br>
</tt><tt>1000 => p.gain;</tt><tt><br>
</tt><tt>0.25 => b.gain;</tt><tt><br>
</tt><tt>4::second => now;</tt><span class=""><tt><br>
</tt><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>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.</div>
<div><br>
</div>
</div>
</div>
</div>
</blockquote>
<br></span>
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).<br>
<br>
<tt>Phasor p => blackhole;</tt><tt><br>
</tt><tt>SinOsc s => dac;</tt><tt><br>
</tt><tt>0.2 => s.gain;</tt><tt><br>
</tt><tt>440 => s.freq;</tt><tt><br>
</tt><tt>1 => p.freq;</tt><tt><br>
</tt><tt><br>
</tt><tt>spork~ hardsync();</tt><tt><br>
</tt><tt><br>
</tt><tt>while (true)</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> second => now;</tt><tt><br>
</tt><tt> p.freq() + 1 => p.freq;</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><tt><br>
</tt><tt>fun void hardsync()</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> float prev;</tt><tt><br>
</tt><tt> while (true)</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> p.last() => float last;</tt><tt><br>
</tt><tt> if (last < prev) 0 => s.phase;</tt><tt><br>
</tt><tt> last => prev;</tt><tt><br>
</tt><tt> samp => now;</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>}</tt><br>
<br>
<br>
<br>
<blockquote type="cite"><span class="">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>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.</div>
<div><br>
</div>
<div>I suspect it is not really doing phase modulation
because it doesn't matter if I change the carrier
frequency, and that is weird.</div>
<div><br>
</div>
<div>well, I guess I'm repeating myself, sorry, just anxious
in the hope of clarification.</div>
<div><br>
</div>
<div>thanks</div>
</div>
</div>
</div>
<br>
<fieldset class="m_8770596230411073960mimeAttachmentHeader"></fieldset>
<br>
</span><span class=""><pre>______________________________<wbr>_________________
chuck-users mailing list
<a class="m_8770596230411073960moz-txt-link-abbreviated" href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.<wbr>princeton.edu</a>
<a class="m_8770596230411073960moz-txt-link-freetext" href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.<wbr>edu/mailman/listinfo/chuck-<wbr>users</a>
</pre>
</span></blockquote>
<br>
</div>
<br>______________________________<wbr>_________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.<wbr>princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.<wbr>edu/mailman/listinfo/chuck-<wbr>users</a><br>
<br></blockquote></div><br></div>