<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hey Forrest,<div class=""><br class=""></div><div class="">What Michael said... I slowed down the script to "10::ms =&gt; now", and I noticed that the sounds at the beginning were pure aliasing (which I kinda loved tbh).</div><div class=""><br class=""></div><div class="">I think it might be related to the pow+log line in your else block at the bottom; maybe it's getting too close to 0 or something? I used (i+10) instead of 'i' as a quick fix, and it seemed to do it, but I'm not sure if that's the sound you're going for.</div><div class=""><br class=""></div><div class="">Hope it helps!</div><div class=""><br class=""></div><div class="">JP</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><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" class="">STARTING_FREQ *&nbsp;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; Math.pow(2.0, -1.0 * Math.log2((1.0*(i+10))/(1.0*OCTAVE_<wbr class="">STEPS))) =&gt; r.freq;</div></blockquote></div></div></blockquote></div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 20/06/2018, at 4:40 PM, Michael Heuer &lt;<a href="mailto:heuermh@gmail.com" class="">heuermh@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">Hello Forrest,<br class=""><br class=""></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 class=""></div><div class=""><br class=""></div><div class="">0.000000 300.000000<br class="">0.005000 3000000.000000<br class="">0.010000 1500000.000000<br class="">0.015000 1000000.000000<br class="">0.020000 750000.000000<br class="">0.025000 600000.000000<br class="">0.030000 500000.000000<br class="">0.035000 428571.428571<br class="">0.040000 375000.000000<br class="">0.045000 333333.333333<br class="">0.050000 300000.000000<br class="">...<br class=""><br class=""></div>Cheers,<br class=""><br class=""></div>&nbsp;&nbsp; michael<br class=""><div class=""><div class=""><br class=""></div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jun 19, 2018 at 11:22 PM, Forrest Cahoon <span dir="ltr" class="">&lt;<a href="mailto:forrest.cahoon@gmail.com" target="_blank" class="">forrest.cahoon@gmail.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">I'm attempting to play with descending tones, but I'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 class=""><br class=""></div><div class="">I'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 class=""><br class=""></div><div class="">Here is my code. How do I fix this?</div><div class=""><br class=""></div>SqrOsc r =&gt; dac; &nbsp;// also try SinOsc, TriOsc, and SawOsc<br class=""><br class="">300.0 =&gt; float STARTING_FREQ;<br class="">10000 =&gt; int OCTAVE_STEPS;<br class="">for (0 =&gt; int i; i &lt; OCTAVE_STEPS ; i++) {<br class="">&nbsp; &nbsp;&nbsp;<br class="">&nbsp; &nbsp; // making an envelope by manipulating the gain<br class="">&nbsp; &nbsp; if (i &lt; 100) {<br class="">&nbsp; &nbsp; &nbsp; &nbsp; i * 0.005 =&gt; r.gain;<br class="">&nbsp; &nbsp; } else if (i &gt; OCTAVE_STEPS - 100) {<br class="">&nbsp; &nbsp; &nbsp; &nbsp; (OCTAVE_STEPS - i) * 0.005 =&gt; r.gain;<br class="">&nbsp; &nbsp; } else {<br class="">&nbsp; &nbsp; &nbsp; &nbsp; 0.5 =&gt; r.gain;<br class="">&nbsp; &nbsp; }<br class="">&nbsp; &nbsp;&nbsp;<br class="">&nbsp; &nbsp; // constantly falling frequency<br class="">&nbsp; &nbsp; if (i == 0) {<br class="">&nbsp; &nbsp; &nbsp; &nbsp; STARTING_FREQ =&gt; r.freq;<br class="">&nbsp; &nbsp; } else {<br class="">&nbsp; &nbsp; &nbsp; &nbsp; STARTING_FREQ * <br class="">&nbsp; &nbsp; &nbsp; &nbsp; Math.pow(2.0, -1.0 * Math.log2((1.0*i)/(1.0*OCTAVE_<wbr class="">STEPS))) =&gt; r.freq;<br class="">&nbsp; &nbsp; }<br class="">&nbsp; &nbsp; 1::ms =&gt; now;<br class="">}<div class=""><br class=""></div></div>
<br class="">______________________________<wbr class="">_________________<br class="">
chuck-users mailing list<br class="">
<a href="mailto:chuck-users@lists.cs.princeton.edu" class="">chuck-users@lists.cs.<wbr class="">princeton.edu</a><br class="">
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank" class="">https://lists.cs.princeton.<wbr class="">edu/mailman/listinfo/chuck-<wbr class="">users</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">chuck-users mailing list<br class=""><a href="mailto:chuck-users@lists.cs.princeton.edu" class="">chuck-users@lists.cs.princeton.edu</a><br class="">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users<br class=""></div></blockquote></div><br class=""></div></body></html>