AudioTimeStretch
✖
AudioTimeStretch

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:
-
r the 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 Automatic the method to use PartitionGranularity Automatic control 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 allBasic Examples (2)Summary of the most common use cases
Stretch audio by a factor of two:

https://wolfram.com/xid/0ywet3v2e7eu-kc30u3

Plot the original and stretched audio:

https://wolfram.com/xid/0ywet3v2e7eu-ov9v2b

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

https://wolfram.com/xid/0ywet3v2e7eu-nbpw4x

Scope (3)Survey of the scope of standard use cases
Stretch an Audio object by a factor of 2:

https://wolfram.com/xid/0ywet3v2e7eu-3wxaq


https://wolfram.com/xid/0ywet3v2e7eu-k9bfsf

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

https://wolfram.com/xid/0ywet3v2e7eu-m3rklt

Stretch the audio object by a factor of 1.5:

https://wolfram.com/xid/0ywet3v2e7eu-biihxy


https://wolfram.com/xid/0ywet3v2e7eu-wj0ynu

Process the audio track of a video:

https://wolfram.com/xid/0ywet3v2e7eu-l7x9gq

Options (4)Common values & functionality for each option
Method (1)
Use Method->"Speech" for speech signals to get a better quality result:

https://wolfram.com/xid/0ywet3v2e7eu-fl2yat

In comparison, the normal time stretching sounds less defined:

https://wolfram.com/xid/0ywet3v2e7eu-9p5f9c

PartitionGranularity (3)
Using a bigger partition size will improve the frequency response but will smear the transient components:

https://wolfram.com/xid/0ywet3v2e7eu-whst33


https://wolfram.com/xid/0ywet3v2e7eu-3gccat

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

https://wolfram.com/xid/0ywet3v2e7eu-qz25v7


https://wolfram.com/xid/0ywet3v2e7eu-gni05i

By default, HannWindow is used:

https://wolfram.com/xid/0ywet3v2e7eu-fyptok

Use Dirichlet window to perform no smoothing:

https://wolfram.com/xid/0ywet3v2e7eu-c5j3cz


https://wolfram.com/xid/0ywet3v2e7eu-d1jyce

Applications (1)Sample problems that can be solved with this function
Change the duration of an audio object to match the duration of another one:

https://wolfram.com/xid/0ywet3v2e7eu-ox1bfs

https://wolfram.com/xid/0ywet3v2e7eu-yph5cs

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

https://wolfram.com/xid/0ywet3v2e7eu-c59922


https://wolfram.com/xid/0ywet3v2e7eu-3b7lki

Properties & Relations (1)Properties of the function, and connections to other functions
Change the duration of a recording by using a different sample rate:

https://wolfram.com/xid/0ywet3v2e7eu-ovulfd
It will also affect the pitch:

https://wolfram.com/xid/0ywet3v2e7eu-uxr4ge

AudioTimeStretch does not alter the pitch:

https://wolfram.com/xid/0ywet3v2e7eu-kvfgtq

Possible Issues (2)Common pitfalls and unexpected behavior
The quality of the result degrades with large stretch parameters:

https://wolfram.com/xid/0ywet3v2e7eu-shsu1w

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

https://wolfram.com/xid/0ywet3v2e7eu-g2l9fu

Wolfram Research (2016), AudioTimeStretch, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioTimeStretch.html (updated 2024).
Text
Wolfram Research (2016), AudioTimeStretch, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioTimeStretch.html (updated 2024).
Wolfram Research (2016), AudioTimeStretch, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioTimeStretch.html (updated 2024).
CMS
Wolfram Language. 2016. "AudioTimeStretch." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/AudioTimeStretch.html.
Wolfram Language. 2016. "AudioTimeStretch." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. 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
Wolfram Language. (2016). AudioTimeStretch. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioTimeStretch.html
BibTeX
@misc{reference.wolfram_2025_audiotimestretch, author="Wolfram Research", title="{AudioTimeStretch}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/AudioTimeStretch.html}", note=[Accessed: 21-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_audiotimestretch, organization={Wolfram Research}, title={AudioTimeStretch}, year={2024}, url={https://reference.wolfram.com/language/ref/AudioTimeStretch.html}, note=[Accessed: 21-April-2025
]}