[chuck-users] How to ramp pitch?

Moisés Gabriel Cachay Tello xpktro at gmail.com
Thu May 22 16:55:11 EDT 2014


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 <bmeisenm at princeton.edu>:

> 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
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>


-- 
-Moisés
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140522/2d5872cb/attachment.htm>


More information about the chuck-users mailing list