Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To represent an increase from 1.0 to 8.0 and back, you could use a function of this form:</p> <pre><code>f(x) = 1 + 7/2*(1 - cos(2*pi*x/y)) </code></pre> <p>Where <code>y</code> is the number of samples in the resulting track.</p> <p>It will start at 1 for <code>x=0</code>, increase to 8 for <code>x=y/2</code>, then decrease back to 1 for <code>x=y</code>.</p> <p>Here's what it looks like for <code>y=10</code>: <img src="https://i.stack.imgur.com/sZjDj.gif" alt="plot 1 + 7/2*(1 - cos(2*pi*x/10)) from 0 to 10"></p> <p>Now we need to find the value of <code>y</code> depending on <code>z</code>, the original number of samples (20,000 in this case but let's be general). For this we solve <a href="http://www.wolframalpha.com/input/?i=solve+integral+1%2B7%2F2+%281-cos%282+pi+x%2Fy%29%29+dx+from+0+to+y+%3D+z" rel="nofollow noreferrer">integral 1+7/2 (1-cos(2 pi x/y)) dx from 0 to y = z</a>. The solution is <code>y = 2*z/9 = z/4.5</code>, nice and simple :)</p> <p>Therefore, for an input with 20,000 samples, you'll get 4,444 samples in the output.</p> <p>Finally, instead of multiplying the output index by the pitch value, you can access the original samples like this: <code>output[i] = input[g(i)]</code>, where <code>g</code> is the integral of the above function <code>f</code>:</p> <pre><code>g(x) = (9*x)/2-(7*y*sin((2*pi*x)/y))/(4*pi) </code></pre> <p>For <code>y=4444</code>, it looks like this:</p> <p><img src="https://i.stack.imgur.com/vmCTc.gif" alt="plot (9*x)/2-(7*4444*sin((2*pi*x)/4444))/(4*pi) from 0 to 4444"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload