<div dir="ltr">so, this is my attempt to make it simpler, having a phasor and a sine wave summed together, then fed into the phase input of an oscillator.<div><br></div><div>but since I never used chuck, I always screw it up, this doesn&#39;t work, but it should be easy to fix</div><div><br></div><div>







<p class="gmail-p1"><span class="gmail-s1">Phasor</span><span class="gmail-s2"> </span>carrier;<span class="gmail-s2"> </span></p>
<p class="gmail-p2">SinOsc<span class="gmail-s2"> mod; </span></p>
<p class="gmail-p2">Gain<span class="gmail-s2"> sum; </span></p>
<p class="gmail-p3"><span class="gmail-s3">1</span><span class="gmail-s2"> =&gt; sum.op; </span>// Gain&#39;s op number 1 is sum</p>
<p class="gmail-p1"><span class="gmail-s3">400</span><span class="gmail-s2"> </span>=&gt;<span class="gmail-s2"> </span>carrier.freq;</p>
<p class="gmail-p1"><span class="gmail-s3">201</span><span class="gmail-s2"> </span>=&gt;<span class="gmail-s2"> </span>mod.freq;</p>
<p class="gmail-p3"><span class="gmail-s3">1</span><span class="gmail-s2"> =&gt; </span><span class="gmail-s4">float</span><span class="gmail-s2"> ind =&gt; mod.gain; </span>// modulation index</p>
<p class="gmail-p1">mod =&gt; sum; </p>
<p class="gmail-p1">carrier<span class="gmail-s2"> </span>=&gt;<span class="gmail-s2"> </span>sum<span class="gmail-s2"> </span>=&gt;<span class="gmail-s2"> </span><span class="gmail-s1">SinOsc</span><span class="gmail-s2"> </span>=&gt;<span class="gmail-s2"> </span><span class="gmail-s4">dac</span>;<span class="gmail-s2"> </span></p>
<p class="gmail-p1"><span class="gmail-s3">1</span> =&gt; osc.sync;</p>
<p class="gmail-p7"><span class="gmail-s3">4</span><span class="gmail-s2">::</span>second<span class="gmail-s2"> =&gt; </span>now<span class="gmail-s2">;</span></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-04 4:16 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>I have translated a PD patch (see the last graph on <a href="http://pd-tutorial.com/english/ch03s06.html" target="_blank">this page</a>) and it is modulating AND responding to frequency changes. See if this does the trick for you (doesn&#39;t sound exactly like your SC code, but I think some fiddling with modulation index can be useful):</div><div><br></div><div><font face="monospace">Step imp; // now I am using an impulse to generate sound after calculating stuff from phasor/sinosc</font></div><div><font face="monospace">Phasor carrier; // Miller said to do so ;)</font></div><div><font face="monospace">SinOsc modul; // a phasor as carrier, a sinosc as modulator</font></div><div><font face="monospace">Gain g; // this object serves only to sum the signals</font></div><div><font face="monospace">1 =&gt; g.op; // op number 1 is sum.</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">400 =&gt; carrier.freq;</font></div><div><font face="monospace">201 =&gt; modul.freq;</font></div><div><font face="monospace">1 =&gt; float ind =&gt; modul.gain; // so, modul. signal * index + carrier signal.</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">imp =&gt; dac; // impulse is actually generating sound</font></div><div><font face="monospace">carrier =&gt; g =&gt; blackhole; // both generators go through a Gain object an then to the blackhole</font></div><div><font face="monospace">modul =&gt; g; // so that they only lend data to the Impulse generator</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">while ( true ) { // this loop includes a timed function only to show that this stuff responds to changes into carrier&#39;s frequency</font></div><div><font face="monospace">    now + 1::second =&gt; time later;</font></div><div><font face="monospace">    while (now &lt; later) {</font></div><div><font face="monospace">        Math.cos(g.last()) =&gt; imp.next; // i am running this through a Cosine function since Phasor is a ramp (let&#39;s smooth that)</font></div><div><font face="monospace">        1::samp =&gt; now;</font></div><div><font face="monospace">    }</font></div><div><font face="monospace">    if ( maybe ) 20 + carrier.freq() =&gt; carrier.freq;</font></div><div><font face="monospace">    else -30 + carrier.freq() =&gt; carrier.freq;</font></div><div><font face="monospace">}</font></div><div><br></div><div>Please notice that Miller Puckette&#39;s approach includes using the phasor as *carrier* and sinosc as *modulator*, so that we can separate phase treatment and wave generation (phasor + cos). I am using an Impulse generator in order to be allowed to pass the resulting signal through the cosine function before sending it to DAC.</div><div><br></div><div>Keep trying...</div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">Em dom, 4 de jun de 2017 às 03:34, 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"><div class="gmail_extra"><div class="gmail_quote">2017-06-04 2:35 GMT-03:00 Alexandre Torres Porres <span dir="ltr">&lt;<a href="mailto:porres@gmail.com" target="_blank">porres@gmail.com</a>&gt;</span>:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div><br></div></span><div>It&#39;s not easy to explain, but you found the magic number/formula that makes Frequency modulation sound like Phase Modulation. </div></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Actually, I shouldn&#39;t have said this, I don&#39;t wanna give you the idea it comes down to this, but there are just too many details I didn&#39;t want get into, sorry. What I can say is that you got pretty close, not 100% there yet, and that is not as simple as just doing this every time, it gets more complicated.</div><div><br></div><div>Sorry again for not getting into the math and everything. What I&#39;d like to add is that people use phase modulation instead of trying to replicate it via frequency modulation cause it&#39;s just more convenient to do directly via phase modulation if you want it to behave like that.</div><div><br></div><div>cheers</div><div><br></div><div><br></div></div></div></div>
</blockquote></div></div></div><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div>