transform_mel_spectrogram.Rd
Create MelSpectrogram for a raw audio signal. This is a composition of Spectrogram and MelScale.
transform_mel_spectrogram(
sample_rate = 16000,
n_fft = 400,
win_length = NULL,
hop_length = NULL,
f_min = 0,
f_max = NULL,
pad = 0,
n_mels = 128,
window_fn = torch::torch_hann_window,
power = 2,
normalized = FALSE,
...
)
(int, optional): Sample rate of audio signal. (Default: 16000
)
(int, optional): Size of FFT, creates n_fft // 2 + 1
bins. (Default: 400
)
(int or NULL, optional): Window size. (Default: n_fft
)
(int or NULL, optional): Length of hop between STFT windows. (Default: win_length // 2
)
(float, optional): Minimum frequency. (Default: 0.
)
(float or NULL, optional): Maximum frequency. (Default: NULL
)
(int, optional): Two sided padding of signal. (Default: 0
)
(int, optional): Number of mel filterbanks. (Default: 128
)
(function, optional): A function to create a window tensor
that is applied/multiplied to each frame/window. (Default: torch_hann_window
)
(float, optional): Power of the norm. (Default: to 2.0
)
(logical): Whether to normalize by magnitude after stft (Default: FALSE
)
(optional): Arguments for window function.
tensor
: Mel frequency spectrogram of size (..., n_mels
, time).
forward param: waveform (Tensor): Tensor of audio of dimension (..., time).
#' Example
if (FALSE) {
if(torch::torch_is_installed()) {
mp3_path <- system.file("sample_audio_1.mp3", package = "torchaudio")
sample_mp3 <- transform_to_tensor(tuneR_loader(mp3_path))
# (channel, n_mels, time)
mel_specgram <- transform_mel_spectrogram(sample_rate = sample_mp3[[2]])(sample_mp3[[1]])
}
}