I haven't ChucKed for a while, but this can help

Pseudocode:

actual_pitch = 440
new_pitch = 880
delta = 1 // -> Increment between steps

while(actual_pitch != new_pitch)
    if (actual_pitch > new_pitch)
        delta = -1 // if we're decreasing pitch
    actual_pitch = actual_pitch + delta //This would be the freq setting
    advance 1ms




2014-05-22 15:39 GMT-05:00 Bonnie Eisenman <[email protected]>:

> Hi all, sorry if this question has been answered before, but I can't find
> it in the docs.
>
> I'd like to ramp a pitch quickly from one frequency to another. I feel
> like there should be a better way to do this than what I'm currently using,
> which is this:
>
> // Where length is the # of milliseconds this should take
> for (0 => int i; i < length $ int; i++) {
>     f1 - ((i/length) * (f1 - f2)) => float newFreq;
>     osc.freq(newFreq);
>     1::ms => now;
> }
>
> This works but it produces an unfortunate clicking noise at the end (and
> yup, I'm using an envelope). Any tips?
>
> Thanks!
>
> --Bonnie
>
> _______________________________________________
> chuck-users mailing list
> [email protected]
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>


-- 
-Moisés
_______________________________________________
chuck-users mailing list
[email protected]
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

Reply via email to