<div dir="ltr">Thanks, Michael and JP!<div><br></div><div>I ended up using this, which takes the log of a number between 1 and 2, instead of trying to take the log of a number near zero:</div><div><br></div>    // constantly falling frequency<br>    2.0 * STARTING_FREQ * <br>    Math.pow(2.0, -1.0 * Math.log2((1.0*(i + OCTAVE_STEPS))/(1.0*OCTAVE_STEPS))) =&gt; r.freq;<div><br></div><div>That works fine.</div><div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 19, 2018 at 10:45 PM JP Yépez &lt;<a href="mailto:jpyepezimc@gmail.com">jpyepezimc@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Hey Forrest,<div><br></div><div>What Michael said... I slowed down the script to &quot;10::ms =&gt; now&quot;, and I noticed that the sounds at the beginning were pure aliasing (which I kinda loved tbh).</div><div><br></div><div>I think it might be related to the pow+log line in your else block at the bottom; maybe it&#39;s getting too close to 0 or something? I used (i+10) instead of &#39;i&#39; as a quick fix, and it seemed to do it, but I&#39;m not sure if that&#39;s the sound you&#39;re going for.</div><div><br></div><div>Hope it helps!</div><div><br></div><div>JP</div><div><br></div><div><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">STARTING_FREQ * <br>        Math.pow(2.0, -1.0 * Math.log2((1.0*(i+10))/(1.0*OCTAVE_STEPS))) =&gt; r.freq;</div></blockquote></div></div></blockquote></div><div><br></div><div><br><div><br><blockquote type="cite"><div>On 20/06/2018, at 4:40 PM, Michael Heuer &lt;<a href="mailto:heuermh@gmail.com" target="_blank">heuermh@gmail.com</a>&gt; wrote:</div><br class="m_-1256490257046643175Apple-interchange-newline"><div><div dir="ltr"><div><div><div>Hello Forrest,<br><br></div>You may want to check your frequency maths -- I added &lt;&lt;&lt;r.gain(), r.freq()&gt;&gt;&gt;; to the loop and the odd sounds at the beginning are frequencies way above human hearing range.<br></div><div><br></div><div>0.000000 300.000000<br>0.005000 3000000.000000<br>0.010000 1500000.000000<br>0.015000 1000000.000000<br>0.020000 750000.000000<br>0.025000 600000.000000<br>0.030000 500000.000000<br>0.035000 428571.428571<br>0.040000 375000.000000<br>0.045000 333333.333333<br>0.050000 300000.000000<br>...<br><br></div>Cheers,<br><br></div>   michael<br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 19, 2018 at 11:22 PM, Forrest Cahoon <span dir="ltr">&lt;<a href="mailto:forrest.cahoon@gmail.com" target="_blank">forrest.cahoon@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I&#39;m attempting to play with descending tones, but I&#39;m having artifacts at the beginning of the sound. I tried to start with a gain of 0 but this does not prevent the glitch.<div><br></div><div>I&#39;ve used various sorts of oscillators; when I use SinOsc there is just a glitch at the very beginning of the sound, but with SqrOsc and others there is what sounds sort of like LFO amplitude modulation for maybe even a second into the sound.</div><div><br></div><div>Here is my code. How do I fix this?</div><div><br></div>SqrOsc r =&gt; dac;  // also try SinOsc, TriOsc, and SawOsc<br><br>300.0 =&gt; float STARTING_FREQ;<br>10000 =&gt; int OCTAVE_STEPS;<br>for (0 =&gt; int i; i &lt; OCTAVE_STEPS ; i++) {<br>    <br>    // making an envelope by manipulating the gain<br>    if (i &lt; 100) {<br>        i * 0.005 =&gt; r.gain;<br>    } else if (i &gt; OCTAVE_STEPS - 100) {<br>        (OCTAVE_STEPS - i) * 0.005 =&gt; r.gain;<br>    } else {<br>        0.5 =&gt; r.gain;<br>    }<br>    <br>    // constantly falling frequency<br>    if (i == 0) {<br>        STARTING_FREQ =&gt; r.freq;<br>    } else {<br>        STARTING_FREQ * <br>        Math.pow(2.0, -1.0 * Math.log2((1.0*i)/(1.0*OCTAVE_STEPS))) =&gt; r.freq;<br>    }<br>    1::ms =&gt; now;<br>}<div><br></div></div>
<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>
_______________________________________________<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" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br></div></blockquote></div><br></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><br>
</blockquote></div></div></div>