<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))) => 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 <<a href="mailto:jpyepezimc@gmail.com">jpyepezimc@gmail.com</a>> 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 "10::ms => now", 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'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><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))) => 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 <<a href="mailto:heuermh@gmail.com" target="_blank">heuermh@gmail.com</a>> 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 <<<r.gain(), r.freq()>>>; 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"><<a href="mailto:forrest.cahoon@gmail.com" target="_blank">forrest.cahoon@gmail.com</a>></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'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><br></div><div>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><br></div><div>Here is my code. How do I fix this?</div><div><br></div>SqrOsc r => dac; // also try SinOsc, TriOsc, and SawOsc<br><br>300.0 => float STARTING_FREQ;<br>10000 => int OCTAVE_STEPS;<br>for (0 => int i; i < OCTAVE_STEPS ; i++) {<br> <br> // making an envelope by manipulating the gain<br> if (i < 100) {<br> i * 0.005 => r.gain;<br> } else if (i > OCTAVE_STEPS - 100) {<br> (OCTAVE_STEPS - i) * 0.005 => r.gain;<br> } else {<br> 0.5 => r.gain;<br> }<br> <br> // constantly falling frequency<br> if (i == 0) {<br> STARTING_FREQ => r.freq;<br> } else {<br> STARTING_FREQ * <br> Math.pow(2.0, -1.0 * Math.log2((1.0*i)/(1.0*OCTAVE_STEPS))) => r.freq;<br> }<br> 1::ms => 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>