# Time stretching allowing for pitch change

I have implemented the WSOLA time stretching algorithm for audio data, but there are still many artifacts from the stretching.

I don't actually care about maintaining pitch and am totally ok with the "chipmunking" effect. What options are available for time stretching in this case? Are there any algorithms I can use that will produce fewer artifacts?

I've only been able to find questions that DO care about maintaining pitch. I've read about resampling, but don't understand exactly how that would work when not trying to double or halve the speed of the sample.

Any information or links are appreciated!

## 1 Answer

Resampling does appear to be the answer for the OP. The point is that you will not change the speed of the sample as you will not change the sampling rate by resampling just the number of samples, so therefore the time represented by each sample must change after resampling. An example will best clarify this :

We have 10 seconds of audio data sampled at 44.1 KHz.

This is a total of 441,000 samples over 10 seconds.

We resample to twice the number of samples by inserting zeros between each sample and then low pass filtering out the images created (standard interpolation techniques that will minimize distortion).

Now we have 882,000 samples.

The thing is we don't actually change the sampling rate! So therefore time must have stretched.

882,000 samples / 44,100 samples/sec = 20 seconds duration!

This will result in a time stretching changing all frequencies accordingly.

Most resampling techniques are described as changing the sampling rate but would be equally applicable to this. So if the resampling technique describes changing the sampling rate by $$M$$, we can equally run the new samples at the same sampling rate and time would have changed by the same $$M$$.

• Thanks so much for the response! I tried to upvote but I have a low rep. I think one thing is still a little unclear to me, what if I want to adjust the duration from 10 to 12 seconds? Does the same technique still work? Sounds like I need to dig in more on interpolation and resampling. Thanks again! Apr 19, 2020 at 5:19
• You can select it as the right answer if I answered your question, your upvotes will also show up once your reputation builds. Yes the same technique still works! Apr 19, 2020 at 5:22
• This post may help you dsp.stackexchange.com/questions/52834/… Apr 19, 2020 at 5:28