pyrubberband.pyrb.time_stretch

pyrubberband.pyrb.time_stretch(y, sr, rate, rbargs=None)[source]

Apply a time stretch of rate to an audio time series.

This uses the tempo form for rubberband, so the higher the rate, the faster the playback.

Parameters:
ynp.ndarray [shape=(n,) or (n, c)]

Audio time series, either single or multichannel

srint > 0

Sampling rate of y

ratefloat > 0

Desired playback rate.

rbargs{key:value, key:value}

Additional keyword parameters for rubberband Accepts a dictionary of key:value pairs supported by rubberband. type(key and value) == str() For single valued rbargs, pass empty string for value. See rubberband -h for details.

Returns:
y_stretchnp.ndarray

Time-stretched audio

Raises:
ValueError

if rate <= 0