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

Kjetil S. Matheussen k.s.matheussen@notam02.no
Tue, 28 Oct 2003 13:36:18 +0100 (MET)

```On Tue, 28 Oct 2003, Kjetil S. Matheussen wrote:

>
>
> On Tue, 28 Oct 2003, Bill Schottstaedt wrote:
>
> >  > 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...)
>
> This is more or less exactly what I do now, and which does not
> work.
>
Sorry, I didnt read your mail well enough. This
function just finds the inverted average. But
how does the integration function look like?

I have a feeling its something like
(something (* 0.5 (* invertaverage invertaverage))
something2)

but I dont know enough math to figure out how
to make the function. And I have tried. :)
(all sunday actually)

--

```