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
waveform
in time, whereas values less than 1.0 stretchwaveform
in time.lengths (torch.Tensor or None, optional) – Valid lengths of signals in
waveform
, with shape (…). IfNone
, all elements inwaveform
are treated as valid. (Default:None
)
- Returns:
- torch.Tensor
Speed-adjusted waveform, with shape (…, new_time).
- torch.Tensor or None
If
lengths
is notNone
, valid lengths of signals in speed-adjusted waveform, with shape (…); otherwise,None
.
- Return type:
(torch.Tensor, torch.Tensor or None)