# [CM] Finding the duration of a time-varying resampled sound.

**Bill Schottstaedt
**
bil@ccrma.Stanford.EDU

*Tue, 28 Oct 2003 04:58:56 -0800*

> (define a '(1 1 0 5))
> (define b '(1 1 0.5 0.5))
> (define c '(0.5 0.5 0 0))
These envelopes don't make any sense -- the x axis is
going backwards?
But my original function wasn't right either (of course...);
here's another stab and if it's wrong, I'll go home and
test the next one!
(define (average-inverse x1 y1 x2 y2)
(/ (* .5 (+ (/ 1.0 y1) (/ 1.0 y2))) (- x2 x1)))
I'm not sure it's the right idea that interpolating a
point on the existing segment should then add to the
original -- since we're actually dealing with the
inverted envelope, the interpolated point probably
changes the slopes of the "true" curve.