<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Alexandre,</p>
    <p><br>
    </p>
    <p>about FM and PM (probably my reply is late!), here's a simple
      implementation using oscillators with sync(0):</p>
    <p><i>// m = mod osc;  c = carrier osc;</i><i><br>
      </i><i>SinOsc m =&gt; Gain g =&gt; SinOsc c =&gt; dac;</i><i><br>
      </i><i>Step cm =&gt; g; //cm = carrier freq in Hz</i><i><br>
      </i><i><br>
      </i><i><br>
      </i><i>while( true ){</i><i><br>
      </i><i>    modInd(10, 250); //arg: modInd, freq mod </i><i><br>
      </i><i>    cm.next(500);</i><i> //carrier frequency<br>
      </i><i>    second =&gt; now;</i><i><br>
      </i><i>}</i><i><br>
      </i><i><br>
      </i><i>fun void modInd( float i, float f ){ //arg: modInd, freq
        mod</i><i><br>
      </i><i>    float am;   </i><i><br>
      </i><i><br>
      </i><i>    i*f =&gt; am; //(modInd = Am/Fm), then (Am = modInd*Fm)</i><i><br>
      </i><i>    m.freq(f);</i><i><br>
      </i><i>    m.gain(am);</i><i><br>
      </i><i>}</i></p>
    <p>this is the simplest modulation, that usually is considered as
      FM, but in the end is a PM.</p>
    <p>without going into details, what's happening is:</p>
    <p>FM (t)=sin(ω c t +Φ c + I sin (ω m t +Φ m ))</p>
    <p>with ω c = carrier freq, ω m = mod freq, Φ = phase<br>
    </p>
    <br>
    Cheers,<br>
    Mario<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 04/06/17 07:34, Alexandre Torres
      Porres wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEAsFmg2T+M1Mf01kvcoYxnxcdieRzBRpXCN1WpjMbmkM_UYkw@mail.gmail.com">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <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"
                moz-do-not-send="true">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 class="">
                      <div><br>
                      </div>
                    </span>
                    <div>It'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>Actually, I shouldn't have said this, I don't wanna
              give you the idea it comes down to this, but there are
              just too many details I didn'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'd like to add is that people use phase
              modulation instead of trying to replicate it via frequency
              modulation cause it'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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
chuck-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a>
<a class="moz-txt-link-freetext" href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>