spafe.fbanks.linear_fbanks

spafe.fbanks.linear_fbanks.linear_filter_banks(nfilts=20, nfft=512, fs=16000, low_freq=None, high_freq=None, scale='constant')[source]

Compute linear-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 linear filters. (Default 0 Hz)
  • high_freq (int) – highest band edge of linear filters. (Default samplerate/2)
  • scale (str) – choose if max bins amplitudes ascend, descend or are constant (=1). Default is “constant”
Returns:

(numpy array) array of size nfilts * (nfft/2 + 1) containing filterbank. Each row holds 1 filter.

Example:

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

# compute fbanks
fbanks = linear_fbanks.linear_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()
alternate text