Time Stretching

Time stretching is an audio digital process; people also refer to it as time compression or time expansion. It involves the modification of a specific passage of time within an audio signal. This process does not alter spectral characteristics, such as a changing pitch. To achieve it, you’ll most likely need to use audible artifacts; otherwise, the process is not easy to obtain. In some musical contexts, artefacts can be acceptable and even useful because they add additional spectral interest. 

Time stretching is a simple and functional tool found in Digital Audio Stations (DAWs). It works great when trying to change the tempo of the track in a DJ set. Similarly, it’s wonderful while getting drum loops to overlap in time with the grid. These tools are also useful when creating mangled sounds, which you can apply to any audio material.

Time Stretching and Algorithms

Time stretching is typically based on a series of complex algorithms, which include time domains or phase coders. The goal of these algorithms is to guess the need for elimination or interpolation of certain samples. After knowing the tempo of the original audio, it’s quite easy to adjust the tempo within a new track. Sound engineers are aware of the fact that it’s always better to increase the tempo of an audio file than to decrease it. 

Algorithms for time stretching have been studied since early investigations on granular synthesis. Granular synthesis operates by dividing the audio stream into granules, which are snippets of audio. On the one hand, to expand the audio times certain granules repeat. On the other, to compress the audio time, some granules are removed from the stream. The crossfading between the granules boundaries helps to minimize the use of artefacts. Although, you must know, these artefacts are not perceptible for everyone.

How It All Came to Be

Around 1978, a time-domain technique called Time Domain Harmonic Scaling (TDHS) emerged. With this technique, users were able to calculate the fundamental frequency of an audio segment using autocorrelation. To time stretch the audio, engeneers used the overlap-add mechanism. This method worked by copying the input audio to an output audio buffer. With this technique, either the input or the output audio buffer is able to time-stretch the audio. Also, the input audio keeps the pitch of the calculated fundamental frequency synchronous by force. You can find this technique also referred to as Pitch Synchronous Overlap-Add (PSOLA).