Re: [linux-audio-dev] math question re. tempo changes

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] math question re. tempo changes
From: est_AT_hyperreal.org
Date: ti joulu  07 1999 - 12:13:18 EST


Paul Winkler discourseth:
> Eli Brandt wrote:
> >
> > ok, we're dealing with
> > tempo: beats per second
> > tempocurve: function from beats to tempo
> > beat_to_clock: function from beats to seconds
> >
> > the basic relationship is
> > d(beat)/d(sec) = tempocurve(t)
> > so
> > d(sec)/d(beat) = 1 / tempocurve(t)
> > so
> > b_t_c(beat) = Integral(from 0 to beat) 1 / tempocurve(b) d(b)
>
> uh-oh.
>
> This is what I was afraid of -- we've left the realm of the math
> courses I took so long ago...

The basic concept is pretty easy. Your changing tempo means that the
rate at which time accumulates per unit beat (which is what
d(sec)/d(beat) is in the language of calculus) is changing. Integrals
are good for taking a changing rate of accumulation and turning it
into a function giving the total of the accumulated quantity (time
here) at any point.

> > you've got a linear tempo curve
> > tempocurve(b) = start_tempo + (b / section_length) *
> > (end_tempo - start_tempo)
> > so in this case
> > b_t_c(beat) = Integral(from 0 to beat)
> > start_tempo +
> > ((end_tempo - start_tempo) / section_length) * b
> > d(b)
> > = 1/k ln(start_tempo + k*b)
>
> That last line looks tantalizingly simple. Too bad I'm lost again...
> what's ln()?

That's the `natural logarithm'..math.log() in python.

> > where
> > k = (end_tempo - start_tempo) / section_length
> >
> > hmm, does that look sane?

The basic idea of integrals is easy..but doing them is (relatively) a
black art. I haven't done this sort of thing in years..but what
better place to refresh than in public. :D

I get:

    b_t_c(beat)
 = Integral(from 0 to beat) start_tempo + k * b d(b)
 = start_tempo * beat + k * beat^2 / 2

Note that `beat' must be 0 at the start of the sequence when plugged
into this formula. Try both and see which sounds better. :)

Eric


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:26 EST