TimeStretch

TimeStretch (clip, float "tempo", float "rate", float "pitch", int "sequence", int "seekwindow", int "overlap", bool "quickseek", int "aa")

TimeStretch allows changing the sound tempo, pitch and playback rate parameters independently from each other, i.e.:

Parameters:

The speed parameters are percentages, and defaults to 100. If tempo is 200 it will play twice as fast, if it is 50, it will play at half the speed. Adjusting rate is equivalent to using AssumeSampleRate and ResampleAudio.

The time-stretch algorithm has a few parameters that can be tuned to optimize sound quality for certain applications. The current default parameters have been chosen by iterative if-then analysis (read: "trial and error") to obtain the best subjective sound quality in pop/rock music processing, but in applications processing different kind of sound the default parameter set may result in a sub-optimal result.

The time-stretch algorithm default parameter values are

Sequence     82
SeekWindow   28
Overlap      12

These parameters affect the time-stretch algorithm as follows:

The table below summarizes how the parameters can be adjusted for different applications:

Parameter nameDefault value magnitudeLarger value affects...Smaller value affects...MusicSpeechEffect in CPU burden
Sequence
Default value is relatively large, chosen for slowing down music tempoLarger value is usually better for slowing down tempo. Growing the value decelerates the "echoing" artifact when slowing down the tempo.Smaller value might be better for speeding up tempo. Reducing the value accelerates the "echoing" artifact when slowing down the tempoDefault value usually goodA smaller value than default might be betterIncreasing the parameter value reduces computation burden
SeekWindow
Default value is relatively large, chosen for slowing down music tempoLarger value eases finding a good mixing position, but may cause a "drifting" artifactSmaller reduce possibility to find a good mixing position, but reduce the "drifting" artifact.Default value usually good, unless a "drifting" artifact is disturbing.Default value usually goodIncreasing the parameter value increases computation burden
Overlap
Default value is relatively large, chosen to suit with above parameters. If you reduce the "sequence ms" setting, you might wish to try a smaller value.  Increasing the parameter value increases computation burden

Notes:

Examples:

TimeStretch(pitch = 200) 

This will raise the pitch one octave, while preserving the length of the original sample.

TimeStretch(pitch = 100.0*pow(2.0, 1.0/12.0)) 

This will raise the pitch one semi-tone, while preserving the length of the original sample.

TimeStretch(tempo = (100.0*25.0*1001.0)/24000.0)

This will change the tempo from Film speed to PAL speed without changing the pitch.

Credits:

This function uses:

SoundTouch library Copyright (c) Olli Parviainen 2002-2006

http://www.iki.fi/oparviai/soundtouch
http://www.surina.net/soundtouch

Changelog:

v2.55Initial Release
v2.57Expose soundtouch parameters

$Date: 2008/12/24 22:55:01 $