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"
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"
On Sat, 29 Oct 2005, Chuckk Hubbard wrote:
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.
That's the same proof that is used in all math textbooks.
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada
I should be writing math textbooks. What does anyone use this particular equality for?
On 10/30/05, Mathieu Bouchard matju@artengine.ca wrote:
On Sat, 29 Oct 2005, Chuckk Hubbard wrote:
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.
That's the same proof that is used in all math textbooks.
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada
-- "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"
On Sun, 30 Oct 2005, Chuckk Hubbard wrote:
I should be writing math textbooks. What does anyone use this particular equality for?
it's used in the formula for computing logarithms and cartesian-to-polar.
given f(x) = sum of x^n for n from 0 upwards = 1/(1-x),
then its integral F(x) = sum of (x^n)/n for n from 0 upwards = -log(1-x)
And combining complex numbers with log, you get atan, a function that turns slopes into angles.
Chances are that your CPU computes log and atan by applying such formulas.
There are many many other applications. Because it's a very simple formula, chances are many people encounter that pattern in many different situations. The place where I've used it most is in Probability Theory (!!!).
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada