Create a spectrogram or a batch of spectrograms from a raw audio signal. The spectrogram can be either magnitude-only or complex.

functional_spectrogram(
  waveform,
  pad,
  window,
  n_fft,
  hop_length,
  win_length,
  power,
  normalized
)

Arguments

waveform

(tensor): Tensor of audio of dimension (..., time)

pad

(integer): Two sided padding of signal

window

(tensor or function): Window tensor that is applied/multiplied to each frame/window or a function that generates the window tensor.

n_fft

(integer): Size of FFT

hop_length

(integer): Length of hop between STFT windows

win_length

(integer): Window size

power

(numeric): Exponent for the magnitude spectrogram, (must be > 0) e.g., 1 for energy, 2 for power, etc. If NULL, then the complex spectrum is returned instead.

normalized

(logical): Whether to normalize by magnitude after stft

Value

tensor: Dimension (..., freq, time), freq is n_fft %/% 2 + 1 and n_fft is the number of Fourier bins, and time is the number of window hops (n_frame).