TimeStretch2:
Filter:
TimeStretch (extension) | UGens > FFT

TimeStretch2
ExtensionExtension

Server Side Time Stretch

Description

Though much slower, TimeStretch is preferred, as it sounds much better. TimeStretch2 is provided more as an experimental convenience, and I cannot guarantee its accuracy. TimeStretch2 also does not work on files with a sample rate other than 44100.

Implements a phase randomized FFT time stretch algorithm, the Ness Stretch, which splits the original sound file into 9 discrete frequency bands, and uses a decreasing frame size to correspond to increasing frequency. Starting with a largest frame of 65536, the algorithm will use the following frequency/frame size breakdown:

0-86hz : 65536

86-172hz : 32768

172-344 : 16384

344-689 : 8192

689-1378 : 4096

1378-2756 : 2048

2756 - 5512 : 1024

5512-11025 : 512

11025-22050 : 256

WARNING: At this time the algorithm only works properly with buffers with a sample rate of 44100.

Class Methods

.stretch

Arguments:

inFile

Path to the input file to be stretch. Can be a mono or stereo file.

Will output a mono or stereo file corresponding to the input. Will output a WAV file up to 4gb and a w64 if larger.

durMult

How many times longer the outFile will be than the inFile. Goes waaaaay past 11 (try 100!).

numSplits

By default, the algorithm will split audio data into 9 frequency "octaves", starting with the first octave below nyquist, then subsequent octaves down from there, leaving everything below the last split to the largest buffer. However, for files of transients, you may want to approach this differently. A number smaller than 9 will leave the top N octaves "normal", but will stop at the number provided. So, a 4 would have a max window size of 2048.

amp

The amplitude. Default is 1.

action

A function to be evaluated when the process has completed. By default it will print "Done stretchin!"

Examples

Will start an NRT server, load the file, and execute the time stretch. Each instance of TimeStretch will run on its own server, so you can run as many simultaneously as your computer can handle.

For best results

Using the numSplits argument. Best used for transients, so they do not smear over a 65536 size fft.