Waveset Time stretching (best solution)

I’m trying to use the Waveset quark to timestrech an audio file.
I don’t care for realtime analysis, but realtime playback would be nice, but not absolutely necessary.

I want that each waveset is realy a waveform, and to avoid false zero-crossings, I use for the analysis a version of my sound file that is very much low-pass filtered and than change the buffer for playback.

w = Wavesets.from(
"C:/Users/indig/Desktop/waveset processing/aFiltered.wav"

b = Buffer.read(s,
"C:/Users/indig/Desktop/waveset processing/aOriginal.wav"

w.buffer = b; // I made the buffer variable writable in Wavesets.sc

The result is not bad, but not perfect.
There are still artefacts, not exactly clicks, but some kind of spectral changes, and when the time stretching is very big, each pitch modification is heard as staircaises.

Maybe this could be solved if we could do some kind of interpolation between the différent wavesets, instead of just repeating them, both in amplitude and (more important) between the size of the following waveforms.

I don’t know how to do that.
The staircase effect happens specially when there is some vibrato or glissando in the sound.

I know this would not solve everything, but maybe in some cases.

Maybe there exist other solutions too ?


Here is an example to here what I did

aOriginal.wav is a short vocal sound
aFiltered.wav is the heavily filtered version used by the calculation

aX10.wav and aX50.wav are the time-stretched files

FWIW, I tried your original file with three different time stretching algorithms in Reaper.

  • Elastique 3.3.3 Pro – occasional hiccups in the sound, although the pitch contour is smoother than in your wavesets approach.
  • Elastique 3.3.3 Soloist – sounds a lot like your wavesets example.
  • Rubber Band Library – slight glitch about every 2.5 seconds.

That is, professionally maintained commercial time stretching libraries were not able to do a 50x time stretch without artifacts – the state of the art falls somewhere below perfection.

The waveset technique looks like a special case of granular synthesis. It might help to apply some of the granular synthesis techniques for smoothing out the result: slight randomness applied to the playback position and rate. (Elastique 3.3.3 Pro seems to be doing this – it has a slightly “chorusy” sound which would be explained by micro-variations in grain play rate.) These would at best smooth over some of the glitches but not eliminate them (I’ve never heard a perfect timestretch anywhere, especially by large factors).


I’m not sure if you are only looking to use Wavesets or if you are more interested in granular time stretching.

One way to go about this would be straight granular stretching with something like TGrains or Warp1. However, many time stretching solutions tend to use a Phase Vocoder. See sections 9.4 and 9.5 of Miller Puckette’s book for an explanation:


The issue with In order for the time stretching phase vocoder to work, phase needs to be accumulated. This is what smooths out the crossfading of samples. Without this, you get the staircase effect you are hearing.

There are lots of examples of FFT-based time stretching in the BufFFT library I just published. It is also possible with PV_BufRd in the SCPlugins library.

Extreme time stretching like 50x stretches need a different approach. There are also examples of PaulStretch and NessStretch in that library that allow for extreme time stretching. Some things will be lost with this approach, so it may not be what you are after. But it can also sound amazing with the right source material.