Shortcuts

torchaudio.functional.spectral_centroid

torchaudio.functional.spectral_centroid(waveform: Tensor, sample_rate: int, pad: int, window: Tensor, n_fft: int, hop_length: int, win_length: int) Tensor[source]

Compute the spectral centroid for each channel along the time axis.

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript

The spectral centroid is defined as the weighted average of the frequency values, weighted by their magnitude.

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

  • sample_rate (int) – Sample rate of the audio waveform

  • pad (int) – Two sided padding of signal

  • window (Tensor) – Window tensor that is applied/multiplied to each frame/window

  • n_fft (int) – Size of FFT

  • hop_length (int) – Length of hop between STFT windows

  • win_length (int) – Window size

Returns:

Dimension (…, time)

Return type:

Tensor

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