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