mindspore.dataset.audio.melscale_fbanks
- mindspore.dataset.audio.melscale_fbanks(n_freqs, f_min, f_max, n_mels, sample_rate, norm=NormType.NONE, mel_type=MelType.HTK)[source]
Create a frequency transformation matrix.
- Parameters
n_freqs (int) – Number of frequencies to highlight/apply.
f_min (float) – Minimum of frequency in Hz.
f_max (float) – Maximum of frequency in Hz.
n_mels (int) – Number of mel filterbanks.
sample_rate (int) – Sample rate of the audio waveform.
norm (NormType, optional) – Normalization method, can be
NormType.NONE
orNormType.SLANEY
. Default:NormType.NONE
.mel_type (MelType, optional) – Scale to use, can be
MelType.HTK
orMelType.SLANEY
. Default:MelType.HTK
.
- Returns
numpy.ndarray, the frequency transformation matrix with shape ( n_freqs , n_mels ).
- Raises
TypeError – If n_freqs is not of type int.
ValueError – If n_freqs is a negative number.
TypeError – If f_min is not of type float.
ValueError – If f_min is greater than f_max .
TypeError – If f_max is not of type float.
ValueError – If f_max is a negative number.
TypeError – If n_mels is not of type int.
ValueError – If n_mels is not positive.
TypeError – If sample_rate is not of type int.
ValueError – If sample_rate is not positive.
TypeError – If norm is not of type
mindspore.dataset.audio.NormType
.TypeError – If mel_type is not of type
mindspore.dataset.audio.MelType
.
- Supported Platforms:
CPU
Examples
>>> from mindspore.dataset.audio import melscale_fbanks >>> >>> fbanks = melscale_fbanks(n_freqs=4096, f_min=0, f_max=8000, n_mels=40, sample_rate=16000)