Re: [music-dsp] Reading a buffer at variable speed

Let's let t be the time, and s be the position in the buffer. So, for
example, playing back at double speed you'd just have s=2*t.

To make it exponential, and have s=0 at t=0, we can write:

s = C*R*(e^(t/C) - 1)

Here R is the initial playback rate (R=1 if it should start at normal
pitch), and C is the "chirp time", the time it takes for the playback rate
to increase by a factor of e.

To figure out how long it will take to play back, we set s=L (the length of
the buffer) and solve for t, giving:

t = C*ln(L/(C*R) + 1)

As for your first question, about why the thing you wrote doesn't seem to
work: it looks similar to some confusion I had when I first tried to figure
out how FM works. If you want a sine wave with an (angular) frequency of 1,
you write sin(t). If you want an angular frequency of 2, you write
sin(2*t). So it's tempting to think that if you want the frequency to be
f(t), a function of t, then you should write sin(f(t)*t). I suspect this is
where the factor of t came from in your equation. But this isn't right!
Instead what you want in my FM example is sin(F(t)), where F is in
antiderivative (i.e. integral) of f. The instantaneous frequency isn't
given by the thing that's multiplying t, it's given by the derivative of
the thing inside the sin function.

Hope that sheds some light on your problem.

-Ethan

On Tue, Feb 6, 2018 at 12:59 PM, Stefan Sullivan <stefan.sulli...@gmail.com>
wrote:

> Can you explain your notation a little bit? Is x[t] the sample index into
> your signal? And t is time in samples?
>
> I might formulate it as a Delta of indicies where a Delta of 1 is a normal
> playback speed and you have some exponential rate. Would something like
> this work?
>
> delta *= rate
> t += delta
> y[n] = x[n - t + N]
>
> My notation probably means something different from yours, but the idea is
> the time varying index t accelerates or decelerates at a given rate. I've
> kind of written a hybrid of pseudocode and DSP notation, sorry.
>
> You would probably actually want some interpolation and for an application
> like this one I would probably stick with linear interpolation (even though
> most people on this list will probably disagree with me on that). Keep in
> mind, though, that skipping samples might mean aliasing which will mean
> low-pass filtering your signal (unless you know that there's no frequency
> content in offensive ranges), and since you're essentially doing a variable
> skip rate your low pass filter might either need to be aggressive or
> variable.
>
> Something about this algorithm scares me in it's seemingly unbounded need
> for memory. Seems like a lot of heuristic constraints...
>
> Stefan
>
>
> On Feb 6, 2018 06:45, "Maximiliano Estudies" <maxiestud...@gmail.com>
> wrote:
>
> I am having trouble with this concept for quite some time now, I hope that
> I can explain it well enough so you can understand what I mean.
> I have signal stored in a buffer of known length. The buffer must be read
> at a variable speed, and the variations in speed have to be exponential, so
> that the resulting glissandi are (aurally) linear. In order to do that I
> came up with the following formula:
>
> x[t] = t * sample_rate * end_speed^(x[t] / T)     where T is the total
> length of the buffer in samples.
>
> This doesn’t seem to work and I can’t understand why.
>
> And my second question is, how can I get the resulting length in
> milliseconds? (how long will it take to play the whole buffer)
>
> I hope I managed to be clear enough!
>
> Maxi
>
> --
> Maximiliano Estudies
> +49 176 36784771 <+49%20176%2036784771>
> maxiestudies.com
>
> _______________________________________________
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
>
>
> _______________________________________________
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp