Shortcuts

torchaudio.functional.compute_deltas

torchaudio.functional.compute_deltas(specgram: Tensor, win_length: int = 5, mode: str = 'replicate') Tensor[source]

Compute delta coefficients of a tensor, usually a spectrogram:

This feature supports the following devices: CPU, CUDA This API supports the following properties: TorchScript
\[d_t = \frac{\sum_{n=1}^{\text{N}} n (c_{t+n} - c_{t-n})}{2 \sum_{n=1}^{\text{N}} n^2} \]

where \(d_t\) is the deltas at time \(t\), \(c_t\) is the spectrogram coeffcients at time \(t\), \(N\) is (win_length-1)//2.

Parameters:
  • specgram (Tensor) – Tensor of audio of dimension (…, freq, time)

  • win_length (int, optional) – The window length used for computing delta (Default: 5)

  • mode (str, optional) – Mode parameter passed to padding (Default: "replicate")

Returns:

Tensor of deltas of dimension (…, freq, time)

Return type:

Tensor

Example
>>> specgram = torch.randn(1, 40, 1000)
>>> delta = compute_deltas(specgram)
>>> delta2 = compute_deltas(delta)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources