Just a note, I came up with a pretty obvious proof for: SUM (k=0 to N-1) i^k = (i^N - 1) / (i - 1) (i - 1) (i^0 + i^1 + i^2 + .... + i^(N-1)) = -i^0 + i^1 - i^1 + i^2 - i^2 ... + i^(N-1) - i^(N-1) + i^N = i^N - 1 All the terms cancel except the lowest and highest powers of i.
On 10/26/05, Chuckk Hubbard badmuthahubbard@gmail.com wrote:
My problem: having tempo change exponentially, but controlling when it would reach the new tempo. So I know the old BPM (a), the new BPM (b), and the number of beats to get from one to the other (B). I set metro to 100 ms. What I don't know is the amount of time those however many beats will take while tempo is changing, how many increments of change there will be (n), and what factor to multiply by tempo with each increment (i). The idea is that, whatever that factor is, it will multiply 10 times a second. So: i^n=b/a Also, the sum of all of the tempos passed through: a*i^0 + a*i^1 + a*i^2 + a*i^3 + .... + a*i^(n-1) So the average BPM for the whole time is: (a*i^0 + a*i^1 + a*i^2 + a*i^3 + .... + a*i^(n-1))/n = v (average) Seconds per beat is the reciprocal of v times 60, and increments-per-beat is 10 times that, and n is then B times that, so: n = 600B/v = 600Bn/SUMk=0->(n-1)(a*i^k) if: n = 600Bn/SUM"""" then: 600B/SUM"""" = 1, or: 600B = (a*i^0 + a*i^1 + a*i^2 ..... + a*i^(n-1)) dividing by a: 600B/a = i^0 + i^1 + i^2 .... i^(n-1) I did some experimenting with constants and found that SUM(k=0->(n-1) i^k is always equal to: ((i^n)-1)/(i-1)
For example, 1+3+9+27+81+243=364, which is (729-1)/2 But since i^n=b/a, this sum is also: ((b/a)-1)/(i-1) So: 600B/a = ((b/a)-1)/(i-1) Yay. Now I know i. i = ((b/a - 1)a/600B)+1 And n is simply the log base i of b/a. I round n to an integer, multiply by 100, and that is the delay before looking up the next tempostructure. Outside of this abstraction, there is simply a metro that bangs a float multiplying tempo by i at 100 ms until stopped by the next tempo. Outputting n at all proved to be unnecessary. -Chuckk
-- "It is not when truth is dirty, but when it is shallow, that the lover of knowledge is reluctant to step into its waters." -Friedrich Nietzsche, "Thus Spoke Zarathustra"
-- "It is not when truth is dirty, but when it is shallow, that the lover of knowledge is reluctant to step into its waters." -Friedrich Nietzsche, "Thus Spoke Zarathustra"