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

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

Arguments

n_fft (integer): Size of FFT (integer): Window size (integer): Length of hop between STFT windows (integer): Two sided padding of signal (tensor or function): Window tensor that is applied/multiplied to each frame/window or a function that generates the window tensor. (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. (logical): Whether to normalize by magnitude after stft (optional) Arguments for window function.

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

Details

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