[chuck-users] Sound glitches at the start of descending tones

Michael Heuer heuermh at gmail.com
Wed Jun 20 00:40:38 EDT 2018


Hello Forrest,

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.

0.000000 300.000000
0.005000 3000000.000000
0.010000 1500000.000000
0.015000 1000000.000000
0.020000 750000.000000
0.025000 600000.000000
0.030000 500000.000000
0.035000 428571.428571
0.040000 375000.000000
0.045000 333333.333333
0.050000 300000.000000
...

Cheers,

   michael


On Tue, Jun 19, 2018 at 11:22 PM, Forrest Cahoon <forrest.cahoon at gmail.com>
wrote:

> 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.
>
> 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.
>
> Here is my code. How do I fix this?
>
> SqrOsc r => dac;  // also try SinOsc, TriOsc, and SawOsc
>
> 300.0 => float STARTING_FREQ;
> 10000 => int OCTAVE_STEPS;
> for (0 => int i; i < OCTAVE_STEPS ; i++) {
>
>     // making an envelope by manipulating the gain
>     if (i < 100) {
>         i * 0.005 => r.gain;
>     } else if (i > OCTAVE_STEPS - 100) {
>         (OCTAVE_STEPS - i) * 0.005 => r.gain;
>     } else {
>         0.5 => r.gain;
>     }
>
>     // constantly falling frequency
>     if (i == 0) {
>         STARTING_FREQ => r.freq;
>     } else {
>         STARTING_FREQ *
>         Math.pow(2.0, -1.0 * Math.log2((1.0*i)/(1.0*OCTAVE_STEPS))) =>
> r.freq;
>     }
>     1::ms => now;
> }
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20180619/b9c46ad1/attachment-0001.html>


More information about the chuck-users mailing list