transform_spectrogram: Spectrogram

transform_spectrogramR Documentation

Spectrogram

Description

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

Usage

transform_spectrogram(
  n_fft = 400,
  win_length = NULL,
  hop_length = NULL,
  pad = 0L,
  window_fn = torch::torch_hann_window,
  power = 2,
  normalized = FALSE,
  ...
)

Arguments

n_fft

(integer): Size of FFT

win_length

(integer): Window size

hop_length

(integer): Length of hop between STFT windows

pad

(integer): Two sided padding of signal

window_fn

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

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

...

(optional) Arguments for window function.

Details

forward param: waveform (tensor): Tensor of audio of dimension (..., time)

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).


torchaudio documentation built on Feb. 16, 2023, 9:41 p.m.