mindspore.dataset.audio.InverseMelScale
- class mindspore.dataset.audio.InverseMelScale(n_stft, n_mels=128, sample_rate=16000, f_min=0.0, f_max=None, max_iter=100000, tolerance_loss=1e-05, tolerance_change=1e-08, sgdargs=None, norm=NormType.NONE, mel_type=MelType.HTK)[源代码]
Solve for a normal STFT form a mel frequency STFT, using a conversion matrix.
- Parameters
n_stft (int) – Number of bins in STFT.
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.0).
f_max (float, optional) – Maximum frequency (default=None, will be set to sample_rate // 2).
max_iter (int, optional) – Maximum number of optimization iterations (default=100000).
tolerance_loss (float, optional) – Value of loss to stop optimization at (default=1e-5).
tolerance_change (float, optional) – Difference in losses to stop optimization at (default=1e-8).
sgdargs (dict, optional) – Arguments for the SGD optimizer (default=None, will be set to {‘sgd_lr’: 0.1, ‘sgd_momentum’: 0.9}).
norm (NormType, optional) – Normalization method, can be NormType.SLANEY or NormType.NONE (default=NormType.NONE).
mel_type (MelType, optional) – Mel scale to use, can be MelType.SLANEY or MelType.HTK (default=MelType.HTK).
Examples
>>> import numpy as np >>> >>> waveform = np.random.randn(2, 2, 3, 2) >>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"]) >>> transforms = [audio.InverseMelScale(20, 3, 16000, 0, 8000, 10)] >>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])