[chuck-users] Sound glitches at the start of descending tones
JP Yépez
jpyepezimc at gmail.com
Wed Jun 20 00:45:40 EDT 2018
Hey Forrest,
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).
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.
Hope it helps!
JP
> STARTING_FREQ *
> Math.pow(2.0, -1.0 * Math.log2((1.0*(i+10))/(1.0*OCTAVE_STEPS))) => r.freq;
> On 20/06/2018, at 4:40 PM, Michael Heuer <heuermh at gmail.com> wrote:
>
> 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 <mailto: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 <mailto:chuck-users at lists.cs.princeton.edu>
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users <https://lists.cs.princeton.edu/mailman/listinfo/chuck-users>
>
>
> _______________________________________________
> 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/20180620/ab6bb430/attachment.html>
More information about the chuck-users
mailing list