interpolated step? (equivalent to max's line)

Hi, I still feel new to chuck, and I'm wondering if there's a UGen that will make a (linear/whatever) ramp from its current value to a specified new value over a specified time? Might there be a way to hack the GenX or Envelope objects to behave this way? (For ppl familiar with max/msp, I'm looking for something equivalent to line~) I want to use this for modulation and for slewing controller input. Since the timescale i'm interested is on the scale of seconds/fractions of seconds, I suppose there's no real need to use a UGen rather than a class or function or something, but I'm still wrapping my head around the way that the ChucK language operates. Thanks, George

On 13 July 2012 20:17, George Locke
sweet. guess i might've figured that one out on my own...
I understand the problem. Like this I have been using it for quite a while, but the need for the extra Step, unless it sets some sort of variable scaling, feels a bit counter-intuitive. I seem to remember it was Perry who first proposed that Envelope without any input should assume a input of 1. That would bring it more closely in line with similar objects in other systems. There is also no problem with asking questions if you looked around a bit; the documentation is a bit scattered. Happy ChucKing, Kas.

there's no way to use this to ramp an arbitrary variable, like the frequency of a SinOsc, for example, is there? Cause I do stuff like this and find it kinda annoying: SinOsc s => dac; 110 => float initial => s.freq; fun void ramp() { 880 => float final; 1::ms => dur res; 500::ms => dur width; (final - initial) / (width / res) => float delta; now => time start; while(now < start + width) { res => now; s.freq() + delta => s.freq; } } spork ~ ramp(); 1::second => now; On Friday, July 13, 2012 at 2:43 PM, Kassen wrote:

given...
Envelope e
e.last() should return the current value generated. For Envelope class, it
ought to be between 0-1 although for something like SinOsc, values range
between -1 and 1.
You could do
e.last() * maxValue => float currentValue;
It's still a little hairy, but a lot less logic than what you're doing.
Also, in some circumstances you won't need the other shred.
-Mike
http://michaelclemow.com
http://semiotech.org
On Fri, Jul 13, 2012 at 2:57 PM, Jordan Orelli

With the way I illustrated you should be able to write arbitrarily large or small values to either .value() or .target(). It is only when using noteOn() and noteOff() (or whatever they were called) that it is forced in the 0-1 range, I believe. Yours, Kas.

I was worried I'd end up with s/t like Jordan's solution; can't try
Kassen's suggestion till i get home, but it does look a lot cleaner.
@Jordan If you want a pitch envelope, you can do s/t like this:
Envelope e => Gain g => SinOsc s => dac;
Step s=> g;
0 => s.sync; // binds s.freq to input from g
100 => float minFreq;
500 => float maxFreq;
minFreq => s.next;
(maxFreq-minFreq) => e.gain; // noteOn() no longer limited to 0-1 ;)
e.noteOn();
I learned how to do this last night for a percussion patch i'm working on.
On Fri, Jul 13, 2012 at 3:38 PM, Kassen

what about: float lineInterpol(float startValue, float endValue, float percent) { if (startValue == endValue) return startValue; return ((1 - percent) * startValue) + (percent * endValue); } Am 13.07.2012 um 22:21 schrieb George Locke:
------------------------------------------------ Audio Engineer / Developer Lars Ullrich F: 00 49/ (0) 30 569 70 435 H: 00 49/ 0172 477 09 77 http://www.larsullrich.de

LiCK has implementations of all the easing interpolations as fuction classes, test here
https://github.com/heuermh/lick/blob/master/InterpolationTest.ck
michael
On Jul 13, 2012, at 2:18 PM, Lars Ullrich
participants (6)
-
George Locke
-
Jordan Orelli
-
Kassen
-
Lars Ullrich
-
Michael Heuer
-
mike clemow