<div dir="ltr">I managed to install SuperCollider and run your example of Phase Modulation. I could achieve the exact same sound with the following ChucK code:<br><br><font face="monospace">SinOsc mod =&gt; SinOsc car =&gt; dac;</font><div><font face="monospace"><br></font></div><div><font face="monospace">400 =&gt; car.freq;</font></div><div><font face="monospace">201 =&gt; mod.freq;</font></div><div><font face="monospace">mod.freq() * Math.PI =&gt; float ind =&gt; mod.gain; // this bugger works with much greater values as standard gain...</font></div><div><font face="monospace">2 =&gt; car.sync; // FM instead of syncing to phase. don&#39;t know why...</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">while ( true ) {</font></div><div><font face="monospace">    1::second =&gt; now;</font></div><div><font face="monospace">}</font></div><div><br></div><div>The weird thing is that I had to use 2 (FM) as a value for .sync, contrary to my intuition of syncing to phase. Another oddity is the way to calculate the modulation index, which I admit was a wild guess that turned out to be correct. I am also curious if anyone can explain this.</div><div><br></div><div>Anyways, the example above sounded exactly like your SC code, and now it responds to changes in the carrier signal, which was what you wanted at first place.</div><div><br></div><div>However, I am now the one struggling to figure out the difference between this phase modulation and FM, since the method used had to be the same as used for Frequency Modulation... syncing to phase, as was my first intuition, yields a rather different sound (much harsher) and does not respond to changes to the carrier&#39;s frequency.</div><div><br></div><div>Hope it can get you going, anyways!</div></div><br><div class="gmail_quote"><div dir="ltr">Em sáb, 3 de jun de 2017 às 23:36, Jean Menezes da Rocha &lt;<a href="mailto:jean@menezesdarocha.info">jean@menezesdarocha.info</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">Alexandre,<div><br></div><div>the thing is that SuperCollider does the iteration stuff automatically for you. In ChucK you have to iterate manually to achieve the same effect. I think your SuperCollider example could adapt as follows:</div><div><br></div><div><font face="monospace">SinOsc car;<br></font></div><div><font face="monospace">SinOsc mod;</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">400 =&gt; car.freq;</font></div><div><font face="monospace">201 =&gt; mod.freq;</font></div><div><font face="monospace">2 * Math.PI =&gt; float ind =&gt; mod.gain; // I don&#39;t know if using PI is relevant here, or linear values between -1 and 1 would suffice!</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">car =&gt; dac;</font></div><div><font face="monospace">mod =&gt; blackhole;</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">while ( true ) {</font></div><div><font face="monospace">    ind * mod.last() =&gt; car.phase;</font></div><div><font face="monospace">    1::samp =&gt; now;</font></div><div><font face="monospace">}</font></div><div><br></div><div>I think advancing time at sample level is the key, as we are using .last() to get accurate values from the modulator. Anyways it indeed does not respond to changes in the carrier&#39;s frequency, which is not what you expect. Changing the modulator&#39;s frequency, however, does effectively change the resulting sound. I honestly don&#39;t know if this is just a plain difference to each language&#39;s approach, or if ChucK has another method to hard sync stuff that we are missing here.</div><div>Please observe that in this example we are not using the .sync parameter; instead we are mapping values for every sample directly to the carrier&#39;s .phase parameter.<br></div><div>Unfortunately I don&#39;t have SC installed here so I cannot compare results. Please let me know.</div><div><br></div><div>Good luck!</div></div><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">Em sáb, 3 de jun de 2017 às 19:04, 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">2017-06-03 15:01 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">Unfortunately, my knowledge of SuperCollider is very limited and I don&#39;t feel like I&#39;m able to translate your code.</div></blockquote><div><br></div></div><div dir="ltr">Here&#39;s an attempt to make SC code clearer.<div><br></div><div>Here&#39;s the fm example I found in chuck, using sync = 2</div><div><br></div><div>







<p class="m_-8499849418660481491m_8958318638761507341gmail-p1">////////////////////////////////////////////////////</p>
<p class="m_-8499849418660481491m_8958318638761507341gmail-p1">SinOsc<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> m =&gt; </span>SinOsc<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> c =&gt; </span><span class="m_-8499849418660481491m_8958318638761507341gmail-s2">dac</span><span class="m_-8499849418660481491m_8958318638761507341gmail-s1">; </span>// modulator to carrier</p>
<p class="m_-8499849418660481491m_8958318638761507341gmail-p1"><span class="m_-8499849418660481491m_8958318638761507341gmail-s3">400</span><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>=&gt;<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>c.freq; // carrier frequency</p>
<p class="m_-8499849418660481491m_8958318638761507341gmail-p4"><span class="m_-8499849418660481491m_8958318638761507341gmail-s3">201</span><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>=&gt;<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>m.freq; // modulator frequency</p>
<p class="m_-8499849418660481491m_8958318638761507341gmail-p1"><span class="m_-8499849418660481491m_8958318638761507341gmail-s3">1500</span><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>=&gt;<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>m.gain; // modulation index</p>
<p class="m_-8499849418660481491m_8958318638761507341gmail-p4"><span class="m_-8499849418660481491m_8958318638761507341gmail-s3">2</span><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>=&gt;<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> </span>c.sync; // FM synthesis (sync is 2)</p>
<p class="m_-8499849418660481491m_8958318638761507341gmail-p5">while<span class="m_-8499849418660481491m_8958318638761507341gmail-s1">( </span>true<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> ) </span><span class="m_-8499849418660481491m_8958318638761507341gmail-s3">1</span><span class="m_-8499849418660481491m_8958318638761507341gmail-s1">::</span>second<span class="m_-8499849418660481491m_8958318638761507341gmail-s1"> =&gt; </span>now<span class="m_-8499849418660481491m_8958318638761507341gmail-s1">; </span>// time-loop</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1">////////////////////////////////////////////////////<br></span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"><br></span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1">And now for the SC equivalent</span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"><br></span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1">////////////////////////////////////////////////////<br></span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">{var carrier = 400; // carrier frequency</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var modulator = 201; // modulator frequency</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var index = 1500; // modulation index</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var m = SinOsc.ar(modulator) * index; // modulating signal</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var c = SinOsc.ar(carrier + m); // frequency modulation (carrier + modulating signal)</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"></span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">Out.ar (0, c ! 2)}.play</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">////////////////////////////////////////////////////<br></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><br></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">and now a phase modulation example in SC</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><br></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1">////////////////////////////////////////////////////<br></span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">{var carrier = 400; // carrier frequency</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var modulator = 201; // modulator frequency</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var index = 2pi; // modulation index</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var m = SinOsc.ar(modulator) * index; // modulating signal</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">var c = SinOsc.ar(carrier, m); // frequency modulation (carrier + modulating signal)</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><span class="m_-8499849418660481491m_8958318638761507341gmail-s1"></span></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">Out.ar (0, c ! 2)}.play</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">////////////////////////////////////////////////////</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><br></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">note, the SinOsc in SuperCollider takes frequency input as the first variable in parenthesis, and phase (in radians) in the second.</p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5"><br></p><p class="m_-8499849418660481491m_8958318638761507341gmail-p5">cheers</p></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-03 15:31 GMT-03:00 Alexandre Torres Porres <span dir="ltr">&lt;<a href="mailto:porres@gmail.com" target="_blank">porres@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 dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>2017-06-03 15:01 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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></blockquote><div> </div></span><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>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>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>
</blockquote></div><br></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></blockquote></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>