Hello Forrest,
You may want to check your frequency maths -- I added <<
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