[CM] is this the best way to do this?
cristopher pierson ewing
cewing@u.washington.edu
Fri, 31 Jan 2003 09:24:57 -0800 (PST)
Bill,
I actually started by doing just that, but I had a problem with it. It
seemed that in the case of an envelope with a base other than one or zero,
if the original line data resulted in a zero crossing, the scaler and
offset values contained in the actual env are readjusted to make such a
thing possible (I was actually overwhelmed at the cleverness of this
method of dealing with the problem of zeroes in exponential envs).
Anyway, when you just take the offset, scaler and base of an exponential
env from the original, rescale the duration and feed them back in, the
envelope ends up getting skewed by this process. The only way I could see
to overcome this was to ignore the values contained in the original env
and just reset the breakpoints and increment values. Here's what I mean:
(setf tom (make-env '(0 1 1 -1) :duration 1 :base 5))
#<env: current-value: 1.000, rate: 0.0,
data: (0 -2.2676251e-5), offset: -1.000, scaler: 0.500,
base: 5, power: 1.000, type: EXP, end: 44099, pass: 0>
As you see, I didn't originally ask for a scaler or offset, but one
appears anyway, due to the exponential zero-crossing. If I do things as
below, here's the result:
(setf joe (change-env-dur tom 0.1)); adding a chunk to get the base, too
#<env: current-value: -0.500, rate: 0.0,
data: (0 -2.268088e-4), offset: -1.000, scaler: 0.500,
base: 5.000, power: NIL, type: SEG, end: 4409, pass: 0>
and the results run from -0.5 to -1.5, rather than from 1 to -1 .
This is why id did it the way I did. It's important for my application to
preserve the entire function of the original envelope, just to change
it's duration in time.
So is there another way I'm not seeing?
Thanks very much,
Cris
********************************
Cris Ewing
CARTAH Assistant
University of Washington
Home Phone: (206) 365-3413
E-mail: cewing@u.washington.edu
*******************************
On Fri, 31 Jan 2003, Bill Schottstaedt wrote:
> > My question is this, am I missing anything vital here?
>
> The original breakpoint data is available (mus-data in Scheme,
> but I apparently forgot the CL case), and I'll bring out the
> offset value, so here's my first stab at it:
>
> (in-package :clm) ; for mus-data/offset defs which will not be needed after Monday
> (defmethod mus-data ((e seg)) (seg-original-data e))
> (defmethod mus-offset ((e seg)) (seg-offset e))
>
> (defun change-env-dur (e dur)
> (make-env (mus-data e)
> :scaler (mus-scaler e)
> :offset (mus-offset e)
> :duration dur))
>
> I'll add the first two to the CL CLM, so you shouldn't need to
> refer to the seg struct -- I treat that part of CLM as an
> internal thing that I change at any time without warning.
> _______________________________________________
> Cmdist mailing list
> Cmdist@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
>