mindspore.dataset.audio.MelScale
- class mindspore.dataset.audio.MelScale(n_mels=128, sample_rate=16000, f_min=0, f_max=None, n_stft=201, norm=NormType.NONE, mel_type=MelType.HTK)[source]
Convert normal STFT to STFT at the Mel scale.
- Parameters
n_mels (int, optional) – Number of mel filterbanks (default=128).
sample_rate (int, optional) – Sample rate of audio signal (default=16000).
f_min (float, optional) – Minimum frequency (default=0).
f_max (float, optional) – Maximum frequency (default=None, will be set to sample_rate // 2).
n_stft (int, optional) – Number of bins in STFT (default=201).
norm (NormType, optional) – Type of norm, value should be NormType.SLANEY or NormType::NONE. If norm is NormType.SLANEY, divide the triangular mel weight by the width of the mel band. (default=NormType.NONE).
mel_type (MelType, optional) – Type to use, value should be MelType.SLANEY or MelType.HTK (default=MelType.HTK).
Examples
>>> import numpy as np >>> >>> waveform = np.array([[0.8236, 0.2049, 0.3335], [0.5933, 0.9911, 0.2482], ... [0.3007, 0.9054, 0.7598], [0.5394, 0.2842, 0.5634], [0.6363, 0.2226, 0.2288]]) >>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"]) >>> transforms = [audio.MelScale(4000, 1500, 0.7)] >>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])