You can try to use Step into Envelope. This is dry coding, and I've had a few beers, but:

Step s => Envelope e => SinOsc s => dac;

1 => s.next;
0 => s.sync;

220 => e.value;
440 => e.target;
1::second => e.duration;

2::second => now;



On Thu, May 22, 2014 at 10:55 PM, Moisés Gabriel Cachay Tello <xpktro@gmail.com> wrote:
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@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@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users




--
-Moisés

_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users




--
Release me, insect, or I will destroy the Cosmos!