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.cah...@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@lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

Reply via email to