pyrubberband.pyrb.timemap_stretch
- pyrubberband.pyrb.timemap_stretch(y, sr, time_map, rbargs=None)[source]
Apply a timemap stretch to an audio time series.
A timemap stretch allows non-linear time-stretching by mapping source to target sample frame numbers for fixed time points within the audio data.
This uses the time and timemap form for rubberband.
- Parameters:
- ynp.ndarray [shape=(n,) or (n, c)]
Audio time series, either single or multichannel
- srint > 0
Sampling rate of y
- time_maplist
Each element is a tuple t of length 2 which corresponds to the source sample position and target sample position.
If t[1] < t[0] the track will be sped up in this area.
time_map[-1] must correspond to the lengths of the source audio and target audio.
- 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 time_map is not monotonic if time_map is not non-negative if time_map[-1][0] is not the input audio length