<div dir="ltr">Alexandre,<div><br></div><div>As far as I understand it, the .sync attribute is more like an identifier, rather than a true numeric value (that is, 0 says you are syncing frequency with frequency; 1 says that you are syncing phase with frequency; 2 says you are doing true Frequency Modulation). As you are telling that no value means no sound, one can infer that there is no default value for that, and if you are feeding UGen =&gt; UGen, telling which is your sync method is mandatory (but I can be mistaken, as usual).</div><div><br></div><div>As for your second question, my understanding of Phase Modulation (as explained <a href="https://en.wikipedia.org/wiki/Phase_modulation">here</a>) is that the carrier wave is supposed to be stationary frequency-wise, so this is the expected behavior. What creates the effect of modulation is the modulator&#39;s *amplitude* over the carrier&#39;s *phase*. There is a nice graphic illustrating this <a href="https://commons.wikimedia.org/wiki/File:Phase-modulation.gif#/media/File:Phase-modulation.gif">here</a>.</div><div><br></div><div>ChucK&#39;s UGen documentation tells that the .phase value is a floating-point number, which seems to be linear. As for the SinOsc object, it should be cycled through a sine function (thus always keeping values between -1.0 and 1.0). In such case, very roughly put, the original phase is always 0, and you can shift from a full cycle to the left (-1) through to a full cycle to the right (+1).</div><div><br></div><div>I am probably missing some fine detail here, and hopefully someone with more solid knowledge of ChucK&#39;s internals will provide you with a more technical explanation. Unfortunately, my knowledge of SuperCollider is very limited and I don&#39;t feel like I&#39;m able to translate your code.</div><div><br></div><div>I will try and prepare some better example later when I have my computer around.</div><div><br></div><div>Best regards!</div><div><br></div><div class="gmail_quote"><div dir="ltr">Em sáb, 3 de jun de 2017 às 14:07, Alexandre Torres Porres &lt;<a href="mailto:porres@gmail.com" target="_blank">porres@gmail.com</a>&gt; escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jean, nice to meet and thanks for your help. I&#39;m still having a hard time figuring this out. Let&#39;s try separate examples for both phase mod and sync, how about that?<div><br></div><div>What puzzles me is the sync argument of SinOsc, it&#39;s not clear how it works, and I haven&#39;t found a good description or examples of it in the documentation. Maybe there is some and I missed it.</div><div><br></div><div>So, I was trying to do either phase modulation or hard sync, and couldn&#39;t do it. Allow me to simplify your code and then I&#39;ll ask more questions.</div><div><br></div><div><br class="m_-5852104780660909104m_8075608618761068691gmail-Apple-interchange-newline">// ==========================<br></div><div>







<p class="m_-5852104780660909104m_8075608618761068691gmail-p1">// *mod* is the SinOsc which will modulate the phase of *carrier*</p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p2"><span class="m_-5852104780660909104m_8075608618761068691gmail-s1">SinOsc</span><span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span>mod<span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span>=&gt;<span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span><span class="m_-5852104780660909104m_8075608618761068691gmail-s1">SinOsc</span><span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span>carrier<span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span>=&gt;<span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span><span class="m_-5852104780660909104m_8075608618761068691gmail-s3">dac</span>;</p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p3"><br></p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p1"><span class="m_-5852104780660909104m_8075608618761068691gmail-s4">440</span><span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> =&gt; carrier.freq; </span>// set carrier frequency</p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p1"><span class="m_-5852104780660909104m_8075608618761068691gmail-s4">1</span><span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> =&gt; mod.gain; </span>// set modulation index</p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p3"><br></p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p1">// set *carrier* oscillator to sync phase-wise with *mod*&#39;s input</p></div></div><div dir="ltr"><div>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p1">// just in case: 0 = sync frequency to input; 1 = sync phase; 2 = FM!</p>
</div></div><div dir="ltr"><div><p class="m_-5852104780660909104m_8075608618761068691gmail-p2"><span class="m_-5852104780660909104m_8075608618761068691gmail-s4">1</span><span class="m_-5852104780660909104m_8075608618761068691gmail-s5"> </span>=&gt;<span class="m_-5852104780660909104m_8075608618761068691gmail-s5"> </span>carrier.sync; </p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p3"><br></p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p1">// set modulation frequency</p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p4">while<span class="m_-5852104780660909104m_8075608618761068691gmail-s2">(</span>true<span class="m_-5852104780660909104m_8075608618761068691gmail-s2">) {</span></p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p2"><span class="m_-5852104780660909104m_8075608618761068691gmail-s2">    </span><span class="m_-5852104780660909104m_8075608618761068691gmail-s4">100</span><span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span>=&gt;<span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> </span>mod.freq;</p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p4"><span class="m_-5852104780660909104m_8075608618761068691gmail-s2">    </span><span class="m_-5852104780660909104m_8075608618761068691gmail-s4">1</span><span class="m_-5852104780660909104m_8075608618761068691gmail-s2">::</span>second<span class="m_-5852104780660909104m_8075608618761068691gmail-s2"> =&gt; </span>now<span class="m_-5852104780660909104m_8075608618761068691gmail-s2">;</span></p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p2">}</p>
<p class="m_-5852104780660909104m_8075608618761068691gmail-p5">// ==========================</p><p class="m_-5852104780660909104m_8075608618761068691gmail-p5"><br></p><p class="m_-5852104780660909104m_8075608618761068691gmail-p5">So, question 1) About &quot;<span class="m_-5852104780660909104m_8075608618761068691gmail-s1">1</span> <span class="m_-5852104780660909104m_8075608618761068691gmail-s2">=&gt;</span> <span class="m_-5852104780660909104m_8075608618761068691gmail-s2">carrier.sync&quot;; </span>I don&#39;t get it. Why if I remove it I don&#39;t have phase modultion or any sound at all?</p><p class="m_-5852104780660909104m_8075608618761068691gmail-p5">Question 2) Why changing the carrier frequency seems to have no effect?</p><p class="m_-5852104780660909104m_8075608618761068691gmail-p5"></p></div><div><div class="gmail_extra"><br></div><div class="gmail_extra">So, let&#39;s compare to a simple phase modulation code in SuperCollider;</div><div class="gmail_extra"><br></div><div class="gmail_extra">{SinOsc.ar(201, SinOsc.ar(50), 2pi) ! 2}.play<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">In SuperCollider, the phase input is in radians, hence, I&#39;m setting the modulation index to 6.28 (2pi). Don&#39;t know how the phase is scaled in Chuck. But if it is linear, such as in Pd/Max, it should be &quot;1&quot; instead.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Anyway, how to achieve the same result as the SuperCollider code?</div><div class="gmail_extra"><br></div><div class="gmail_extra">thanks</div></div></div><div dir="ltr"><div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-03 12:43 GMT-03:00 Jean Menezes da Rocha <span dir="ltr">&lt;<a href="mailto:jean@menezesdarocha.info" target="_blank">jean@menezesdarocha.info</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello, Alexandre, good to see you here (you don&#39;t know me but I know your work)!<br><br>SinOsc has .phase and .sync attributes, which are pretty useful in this case. I made a very<div>dirty and arbitrary example to show this working (using .sync, in this case):</div><div><br></div><div><div><font face="monospace">// *pmod* is the SinOsc which will modulate the phase of *main*</font></div><div><font face="monospace">SinOsc pmod =&gt; SinOsc main =&gt; dac;</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">440 =&gt; main.freq;</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">// define index of modulation; it&#39;s fun to fiddle with this value!</font></div><div><font face="monospace">50 =&gt; pmod.gain;</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">// set *main* to sync phase-wise with *pmod*&#39;s input</font></div><div><font face="monospace">// just in case: 0 = sync frequency to input; 1 = sync phase; 2 = FM!</font></div><div><font face="monospace">1 =&gt; main.sync;</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">// loop to show phase modulation in action with random arbitrary values</font></div><div><font face="monospace">while(true) {</font></div><div><font face="monospace">    Math.random2f(63, 880) =&gt; pmod.freq;</font></div><div><font face="monospace">    1::second =&gt; now;</font></div><div><font face="monospace">}</font></div></div><div><font face="monospace"><br></font></div><div><font size="2">You can also do everything &quot;by hand&quot;, mapping arbitrary values directly into SinOsc&#39;s .phase attribute.</font></div><div><font size="2"><br></font></div><div><font size="2">Hope it helps!</font></div><div><font size="2"><br></font></div><div><font size="2">Cheers!</font></div><div><br></div></div><br><div class="gmail_quote"><div><div class="m_-5852104780660909104m_8075608618761068691gmail-h5"><div dir="ltr">Em sex, 2 de jun de 2017 às 19:21, Alexandre Torres Porres &lt;<a href="mailto:porres@gmail.com" target="_blank">porres@gmail.com</a>&gt; escreveu:<br></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="m_-5852104780660909104m_8075608618761068691gmail-h5"><div dir="ltr">Hi, new to chuck here.<div><br></div><div>Can SinOsc be hard synced by an impulse or something?</div><div><br></div><div>And how would you do phase modulation with SinOsc?</div><div><br></div><div>If you cannot do one or both with SinOsc, how would you do it?</div><div><br></div><div>thanks</div></div></div></div>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><span class="m_-5852104780660909104m_8075608618761068691gmail-HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><span class="m_-5852104780660909104m_8075608618761068691gmail-HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div><div dir="ltr">Jean Menezes da Rocha<div>Compositor</div><div>Professor</div><div>Doutorando em Música pela Universidade Federal da Bahia</div></div></div>
</font></span><br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br></div></div></div></blockquote></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Jean Menezes da Rocha<div>Compositor</div><div>Professor</div><div>Doutorando em Música pela Universidade Federal da Bahia</div></div></div>