AudioTimeStretch

AudioTimeStretch[audio,r]

applies time stretching to audio by the specified factor r.

Details and Options

  • AudioTimeStretch stretches the input audio signal to the specified duration while preserving the pitch.
  • The factor r can be any of the following:
  • rthe duration will be multiplied by r
    Scaled[r]the duration will be multiplied by r
    Quantity[dur,unit]specifies the resulting duration dur in the given time unit
  • The following options are supported:
  • Method Automaticthe method to use
    PartitionGranularity Automaticcontrol the partitioning used for the computation of the short-time Fourier transform
  • By default, a phase vocoder algorithm is used. Use Method->"Speech" for time stretching speech signals.

Examples

open allclose all

Basic Examples  (2)

Stretch audio by a factor of two:

Plot the original and stretched audio:

Stretch an Audio object to a full duration of 3 seconds:

Scope  (2)

Stretch an Audio object by a factor of 2:

AudioTimeStretch alters the duration of complex sound without changing its timbre and pitch:

Stretch the audio object by a factor of 1.5:

Options  (4)

Method  (1)

Use Method->"Speech" for speech signals to get a better quality result:

In comparison, the normal time stretching sounds less defined:

PartitionGranularity  (3)

Using a bigger partition size will improve the frequency response but will smear the transient components:

Using a small offset value will in general increase the quality of the result at the cost of more computation time:

By default, HannWindow is used:

Use Dirichlet window to perform no smoothing:

Specify a different window:

Applications  (1)

Change the duration of an audio object to match the duration of another one:

Stretch the audio to match the duration of the target one:

Properties & Relations  (1)

Change the duration of a recording by using a different sample rate:

It will also affect the pitch:

AudioTimeStretch does not alter the pitch:

Possible Issues  (2)

The quality of the result degrades with large stretch parameters:

Using Method->"Speech" for non-speech signals may not lead to expected results:

Wolfram Research (2016), AudioTimeStretch, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioTimeStretch.html (updated 2020).

Text

Wolfram Research (2016), AudioTimeStretch, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioTimeStretch.html (updated 2020).

CMS

Wolfram Language. 2016. "AudioTimeStretch." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/AudioTimeStretch.html.

APA

Wolfram Language. (2016). AudioTimeStretch. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioTimeStretch.html

BibTeX

@misc{reference.wolfram_2024_audiotimestretch, author="Wolfram Research", title="{AudioTimeStretch}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/AudioTimeStretch.html}", note=[Accessed: 23-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_audiotimestretch, organization={Wolfram Research}, title={AudioTimeStretch}, year={2020}, url={https://reference.wolfram.com/language/ref/AudioTimeStretch.html}, note=[Accessed: 23-April-2024 ]}