code: def spectral_centroid(
      waveform: Tensor,
      sample_rate: int,
      pad: int,
      window: Tensor,
      n_fft: int,
      hop_length: int,
      win_length: int,
  ) -> Tensor:
      r"""Compute the spectral centroid for each channel along the time axis.
  
      .. devices:: CPU CUDA
  
      .. properties:: Autograd TorchScript
  
      The spectral centroid is defined as the weighted average of the
      frequency values, weighted by their magnitude.
  
      Args:
          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:
          Tensor: Dimension `(..., time)`
      """
      specgram = spectrogram(
          waveform,
          pad=pad,
          window=window,
          n_fft=n_fft,
          hop_length=hop_length,
          win_length=win_length,
          power=1.0,
          normalized=False,
      )
      freqs = torch.linspace(
          0,
          sample_rate // 2,
          steps=1 + n_fft // 2,
          device=specgram.device,
      ).reshape((-1, 1))
      freq_dim = -2
      return (freqs * specgram).sum(dim=freq_dim) / specgram.sum(
          dim=freq_dim
      )
  
imports: import math
  import tempfile
  import warnings
  from collections.abc import Sequence
  from typing import List, Optional, Tuple, Union
  import torch
  import torchaudio
  from torch import Tensor
  from torchaudio._internal.module_utils import deprecated
  from .filtering import highpass_biquad, treble_biquad
label_desc: Use image node_id 27 for calling a global function with example usage: spectral_centroid(waveform, sample_rate, pad, window, n_fft, hop_length, win_length) and returns: unknown