stretch(1)
โจ stretch(1) โ Sound Data Time Stretching โจ
ok so bestie, welcome to the stretch manual page ๐ (that's section 1 of the manual, the "Sound Data Time Stretching" one, iykyk). grab a snack, we're gonna talk about making audio longer and shorter without the pitch going all weird ๐
๐ธ NAME ๐ธ
stretch โ literally the time stretching tool for sound data. that's the whole vibe ๐
๐ฆ SYNOPSIS ๐ฆ
stretch [options] [input [output]]
โญ DESCRIPTION โญ
okay so here's the tea โ โ the stretch utility lets you lengthen or shorten the duration of an audio data stream without affecting the pitch of the sampled data. iconic behaviour honestly ๐
how does it do it? it employs phase-vocoding to achieve the effect, which usually leads to better results than time-domain techniques. no cap, that's the good stuff โจ
your input audio data can be made of multiple channels, and in that case the output is multichannel too. we match, we serve ๐ซถ
now, both output and input can be '-', which means the signal data gets read from stdin or written to stdout respectively. (you can also just omit the file names for the same effect, starting with output.) in either case, the sample format is signed 16-bit little-endian โ aka CD format, the classic ๐ฟ
for physical file access, the utility makes use of the sndfile library. the tool tries to guess the intended output file format from the filename extension ๐ต๏ธโโ๏ธ and on top of that, you can specify the output bit depth (quantization) with the -b (--bits) parameter.
โ ๏ธ heads up bestie: the tool is not capable of directly replacing the contents of the input file. so don't even try to overwrite your source, it's not gonna happen ๐
๐ OPTIONS ๐
the simplest invocation of the tool is:
stretch -t 1.5 infile.wav outfile.wav
this example stretches infile.wav to 150 % duration and writes the result to outfile.wav. cute, right? ๐
๐ Most useful options:
-t,--times <stretch factor>โ sets the ratio by which the duration of the sound signal is scaled. extreme values can cause audible artefacts in the output signal, usually perceived as cyclic amplitude modulation ๐ญ (yes that's the wobbly robot voice thing). to achieve an exact time expansion/compression ratio, the product of this and the-o(--overlap) parameter needs to be an integer value. math is math, periodt ๐งฎ-a,--amplify <factor>โ sets the linear amplification factor for the output signal. the default value is1.0. ๐-q,--quietโ makes the utility be silent about what it does. it's giving "no thoughts, head empty" ๐คซ
๐ง Processing control options:
-f,--fft <DFT length>โ sets the length of the DFT (discrete Fourier transform), which should be a power of two for best results. odd values may cause the utility to throw up ๐ (not even kidding, that's the actual wording). larger DFT sizes imply better frequency resolution at the cost of increased computational demand. the default value is1024samples.-o,--overlap <overlap>โ controls the interval at which recomposition of the signal takes place. smaller values imply a smoother result in exchange for increased computational demand. the default value is128samples โจ
๐ Piped input signal options:
if signal input is from stdin, the default assumption about the data format (other than the aforementioned 16-bit signed little-endian convention) is two-channel audio at 44.1 kHz sample rate. the following options override these ๐
-c,--channels <channel count>โ no surprises:1is mono,2stereo etc. simple as that bestie ๐ซ-r,--rate <sample rate>โ sets the sample rate. yes, that's it. that's the whole thing ๐ถ
๐ Output bit depth:
-b,--bits <quantization>โ sets the output bit depth (only for physical file output).8,16or24for signed integers,32or64for floating point. the default is 16-bit. (internal precision is 32 bit floating-point, fyi ๐)-l,--limitโ this option causes the utility to clip the output signal to stay within the output quantization or the[-1,+1]range if output is in floating-point format. the use of this flag is highly recommended when output is in integer sample format (--bitsless than32or stdout output). seriously bestie, use it. it's giving self-care ๐ซถ
๐ฅ Information options:
-h,--helpโ prints version information and a list of supported file formats/extensions, then quits. the "who am i and what can i do" moment ๐-v,--versionโ prints version information, then quits. short and sweet ๐
๐ EXAMPLES ๐
a few example invocations of the utility, all assuming source data is in CD format (signed 16-bit samples, stereo, 44.1 kHz) ๐ฟโจ
stretch -o 100 -t 1.2 cdda.wav | aplay -fcd
stretches cdda.wav to exactly 120 %, piping the output to the aplay program for immediate playback. instant gratification, we love to see it ๐ฅ
cat file.ogg | oggdec - | stretch -t.8 | aplay -fcd
plays back an ogg stream, accelerated to 80 % duration. and if you prefer mp3, an equivalent incantation is:
madplay -o raw:- file.mp3 | stretch -t.8 | aplay -f cd
(i know, -f cd with a space vs -fcd without โ that's literally how it's written in here, so i'm keeping it exactly as-is, don't come for me ๐)
๐ BUGS ๐
ok so the honest section, and it's giving struggle:
- lousy command line parsing and error feedback ๐ญ
- lots of combinations of output file formats and quantization untested, as is the operation on big-endian systems โ ๏ธ
- phase vocoding chews a lot of CPU cycles. it's a hungry girl, she eats your processor for breakfast ๐ณ
๐ AUTHORS ๐
the original phase vocoder implementation was done by Mark Dolson at UCSD, part of the CARL suite, skillfully converted to streaming operation by Richard Dobson โจ
the stretch tool and this manual page were written by Tim Goetze <tim@quitte.de>. respect the icons ๐ซถ
๐ HOMEPAGE ๐
the latest version of this tool can be obtained from http://quitte.de/dsp/pvoc.html ๐ go get it bestie, it's right there
<div align="center">๐ธ</div>
and that's the whole page!! ๐ this version landed on March 25, 2004 (vintage, honestly โ she's an elder millennial tool but the vibes are immaculate), and it's dated as such at the bottom of the original. mwah, go stretch some audio ๐โจ๐
๐ฆ where this page comes from
- arch rolling: pvoc 0.1.12-6 ยท GPL2
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms