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

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

*Tue, 28 Oct 2003 04:14:00 -0800*

> What I need is a general formula for the scale-factor 's'
> between two points (x1,y1) and (x2,y2), where y1 and y2 are
> always positive values.
I think you want the average of the inverse; the "tempo map"
idea here would be to integrate the inverse of the envelope,
then multiply that by the in-coming note length. But for
each segment, I think this would do it:
(define (invert-average x1 y1 x2 y2)
(/ (- x2 x1) (* .5 (+ y1 y2))))
(Didn't actually test this...)