Mel Filter Bank

Module name: melbank

This module implements a Mel Filter Bank. In other words it is a filter bank with triangular shaped bands arnged on the mel frequency scale.

An example ist shown in the following figure:

(Source code)


melbank.compute_melmat(num_mel_bands=12, freq_min=64, freq_max=8000, num_fft_bands=513, sample_rate=16000)[source]

Returns tranformation matrix for mel spectrum.


num_mel_bands : int

Number of mel bands. Number of rows in melmat. Default: 24

freq_min : scalar

Minimum frequency for the first band. Default: 64

freq_max : scalar

Maximum frequency for the last band. Default: 8000

num_fft_bands : int

Number of fft-frequenc bands. This ist NFFT/2+1 ! number of columns in melmat. Default: 513 (this means NFFT=1024)

sample_rate : scalar

Sample rate for the signals that will be used. Default: 44100


melmat : ndarray

Transformation matrix for the mel spectrum. Use this with fft spectra of num_fft_bands_bands length and multiply the spectrum with the melmat this will tranform your fft-spectrum to a mel-spectrum.

frequencies : tuple (ndarray <num_mel_bands>, ndarray <num_fft_bands>)

Center frequencies of the mel bands, center frequencies of fft spectrum.


Returns mel-frequency from linear frequency input.


mel : scalar or ndarray

Mel-frequency value or ndarray in Mel


Returns frequency from mel-frequency input.


freq : scalar or ndarray

Frequency value or array in Hz.

melbank.melfrequencies_mel_filterbank(num_bands, freq_min, freq_max, num_fft_bands)[source]

Returns centerfrequencies and band edges for a mel filter bank Parameters ———- num_bands : int

Number of mel bands.
freq_min : scalar
Minimum frequency for the first band.
freq_max : scalar
Maximum frequency for the last band.
num_fft_bands : int
Number of fft bands.

center_frequencies_mel : ndarray

lower_edges_mel : ndarray

upper_edges_mel : ndarray