<div>Just a note, I came up with a pretty obvious proof for:</div>
<div>&nbsp;</div>
<div>SUM (k=0 to N-1) i^k = (i^N - 1) / (i - 1)</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>(i - 1) (i^0 + i^1 + i^2 + .... + i^(N-1))</div>
<div>=</div>
<div>-i^0 + i^1 - i^1 + i^2 - i^2 ... + i^(N-1) - i^(N-1) + i^N</div>
<div>= i^N - 1</div>
<div>All the terms cancel except the lowest and highest powers of i.<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 10/26/05, <b class="gmail_sendername">Chuckk Hubbard</b> &lt;<a href="mailto:badmuthahubbard@gmail.com">badmuthahubbard@gmail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>My problem: having tempo change exponentially, but controlling when it would reach the new tempo.&nbsp; So I know the old&nbsp;BPM (a), the new&nbsp;BPM (b), and the number of beats to get from one to the other (B).&nbsp; I set metro to 100 ms.&nbsp; 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).&nbsp; The idea is that, whatever that factor is, it will multiply 10 times a second. 
</div>
<div>So:</div>
<div>i^n=b/a</div>
<div>&nbsp;</div>
<div>Also, the sum of all of the tempos passed through:</div>
<div>a*i^0 + a*i^1&nbsp;+ a*i^2&nbsp;+ a*i^3 + .... + a*i^(n-1)</div>
<div>&nbsp;</div>
<div>So the average BPM for the whole time is:</div>
<div>(a*i^0 + a*i^1&nbsp;+ a*i^2&nbsp;+ a*i^3 + .... + a*i^(n-1))/n = v (average)</div>
<div>&nbsp;</div>
<div>Seconds per beat is the reciprocal of v&nbsp;times 60, and increments-per-beat is 10 times that, and&nbsp;n is then B times that,&nbsp;so:</div>
<div>n = 600B/v = 600Bn/SUMk=0-&gt;(n-1)(a*i^k)</div>
<div>&nbsp;</div>
<div>if:</div>
<div>n = 600Bn/SUM&quot;&quot;&quot;&quot;</div>
<div>then:</div>
<div>600B/SUM&quot;&quot;&quot;&quot;&nbsp; = 1, or:</div>
<div>600B = (a*i^0 + a*i^1 + a*i^2 ..... + a*i^(n-1))</div>
<div>&nbsp;</div>
<div>dividing by a:</div>
<div>600B/a = i^0 + i^1 + i^2 .... i^(n-1)</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>I did some experimenting with constants and found that&nbsp;SUM(k=0-&gt;(n-1)&nbsp;i^k&nbsp;is always equal to:</div>
<div>((i^n)-1)/(i-1)</div>
<div>&nbsp;</div>
<div><br clear="all">For example, 1+3+9+27+81+243=364, which is (729-1)/2</div>
<div>&nbsp;</div>
<div>But since i^n=b/a, this sum is also:</div>
<div>((b/a)-1)/(i-1)</div>
<div>&nbsp;</div>
<div>So:</div>
<div>600B/a = ((b/a)-1)/(i-1)</div>
<div>&nbsp;</div>
<div>Yay.&nbsp; Now I know i.</div>
<div>&nbsp;</div>
<div>i = ((b/a - 1)a/600B)+1</div>
<div>&nbsp;</div>
<div>And n is simply the log base i of b/a.</div>
<div>&nbsp;</div>
<div>I round n to an integer, multiply by 100, and that is the delay before looking up the next tempostructure.&nbsp; 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.&nbsp; Outputting n at all&nbsp;proved to be unnecessary. 
</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>-Chuckk</div><span class="sg">
<div><br>-- <br>&quot;It is not when truth is dirty, but when it is shallow, that the lover of knowledge is reluctant to step into its waters.&quot;<br>-Friedrich Nietzsche, &quot;Thus Spoke Zarathustra&quot; </div></span>
<br clear="all"></blockquote></div><br><br clear="all"><br>-- <br>&quot;It is not when truth is dirty, but when it is shallow, that the lover of knowledge is reluctant to step into its waters.&quot;<br>-Friedrich Nietzsche, &quot;Thus Spoke Zarathustra&quot;