# spafe.fbanks.bark_fbanks¶

spafe.fbanks.bark_fbanks.Fm(fb, fc)[source]

Compute a Bark filter around a certain center frequency in bark.

Parameters: fb (int) – frequency in Bark. fc (int) – center frequency in Bark. associated Bark filter value/amplitude. (float)
spafe.fbanks.bark_fbanks.bark_filter_banks(nfilts=20, nfft=512, fs=16000, low_freq=0, high_freq=None, scale='constant')[source]

Compute Bark-filterbanks. The filters are stored in the rows, the columns correspond to fft bins.

Parameters: nfilts (int) – the number of filters in the filterbank. (Default 20) nfft (int) – the FFT size. (Default is 512) fs (int) – sample rate/ sampling frequency of the signal. (Default 16000 Hz) low_freq (int) – lowest band edge of mel filters. (Default 0 Hz) high_freq (int) – highest band edge of mel filters. (Default samplerate/2) scale (str) – choose if max bins amplitudes ascend, descend or are constant (=1). Default is “constant” a numpy array of size nfilts * (nfft/2 + 1) containing filterbank. Each row holds 1 filter.

Example:

import matplotlib.pyplot as plt
from spafe.fbanks import bark_fbanks

# compute fbanks
fbanks = bark_fbanks.bark_filter_banks(nfilts=24, nfft=512, fs=16000)

# plot fbanks
for i in range(len(fbanks)):
plt.plot(fbanks[i])
plt.ylim(0, 1.1)
plt.grid(True)
plt.ylabel(ylabel)
plt.xlabel(xlabel)
plt.show() 