- torchaudio.functional.speed(waveform: Tensor, orig_freq: int, factor: float, lengths: Optional[Tensor] = None) Tuple[Tensor, Optional[Tensor]] [source]¶
Adjusts waveform speed.
waveform (torch.Tensor) – Input signals, with shape (…, time).
orig_freq (int) – Original frequency of the signals in
factor (float) – Factor by which to adjust speed of input. Values greater than 1.0 compress
waveformin time, whereas values less than 1.0 stretch
lengths (torch.Tensor or None, optional) – Valid lengths of signals in
waveform, with shape (…). If
None, all elements in
waveformare treated as valid. (Default:
Speed-adjusted waveform, with shape (…, new_time).
- torch.Tensor or None
None, valid lengths of signals in speed-adjusted waveform, with shape (…); otherwise,
- Return type:
(torch.Tensor, torch.Tensor or None)