<div dir="ltr">Thanks joel, it&#39;s starting to make sense to me now.<div><br></div><div>I&#39;d suggest more examples in the documentation explaining what this sync parameter is and works so it&#39;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">&lt;<a href="mailto:jwmatthys@gmail.com" target="_blank">jwmatthys@gmail.com</a>&gt;</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 &quot;0&quot;, I hear no sound.</div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    I think &quot;sync&quot; 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 =&gt; SinOsc b =&gt; dac;<br>
    0 =&gt; 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&#39;s a demonstration of how sync 0 can work:<br>
    <br>
    <tt>Phasor p =&gt; SinOsc b =&gt; dac;</tt><tt><br>
    </tt><tt>1 =&gt; p.freq;</tt><tt><br>
    </tt><tt>1000 =&gt; p.gain;</tt><tt><br>
    </tt><tt>0.25 =&gt; b.gain;</tt><tt><br>
    </tt><tt>4::second =&gt; 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&#39;t seem like the sync parameter is able
              to do hard sync. It seemed that the &quot;0&quot; value would do
              that, but, as I said, I hear nothing.</div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    I think you&#39;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 =&gt; blackhole;</tt><tt><br>
    </tt><tt>SinOsc s =&gt; dac;</tt><tt><br>
    </tt><tt>0.2 =&gt; s.gain;</tt><tt><br>
    </tt><tt>440 =&gt; s.freq;</tt><tt><br>
    </tt><tt>1 =&gt; 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 =&gt; now;</tt><tt><br>
    </tt><tt> p.freq() + 1 =&gt; 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() =&gt; float last;</tt><tt><br>
    </tt><tt>      if (last &lt; prev) 0 =&gt; s.phase;</tt><tt><br>
    </tt><tt>      last =&gt; prev;</tt><tt><br>
    </tt><tt>      samp =&gt; 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&#39;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&#39;t matter if I change the carrier
              frequency, and that is weird.</div>
            <div><br>
            </div>
            <div>well, I guess I&#39;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>