function [time_freq] = filterbank(inp)
%
% Simulation of an auditory perception model.
%
% input: time sequence, continuous time, no windowing
% output: time-frequency representation.
%
% Author: Yunbin Deng, work performed at Johns Hopkins Univeristy.
% yunbin.deng@baesystems.com or yunbindeng@gmail.com
%
% Note: need to ran fb_para once to set the filterbank parameters
% and then filterbank.m can be called in batch mode
%
% The algorithm was published in the following papers:
% 1. "Analog Auditory Perception Model for Robust Speech Recognition", Y. Deng, S.
% Chakrabartty, and G. Cauwenberghs, Proc. IEEE Int. Joint Conf. on Neural Network
% (IJCNN), Budapest Hungary, 2004.
% 2. "Analog Auditory Perception Model for Robust Speaker Recognition", Y. Deng, R. Xu,
% IASTED, Signal and Image Processing, Honolulu, Hawaii, 2006.
%
% All rights reserved, free for academic education and non-profit research only.
%
%
global bhd ahd; % pre_amp
global bbd abd; % bandpass
global bld ald ; % lowpass
global bbd_last abd_last; % bandpass
global numChannel;
% setp 1: first order analog high pass filter
sig = filter(bhd,ahd,inp);
% step 2: N channel Mel/BARK-scale filter bank
for j = 1 : numChannel,
y = filter(bbd(j,:),abd(j,:),sig); % do it just once, twice almost does not help.
% step 3: absolute value
y = abs(y - mean(y)) ;
% step 4: lowpass filter envelp extractor
y = filter(bld(j,:), ald(j,:), y); % does not help much
% step 5: non-linear compression/bandpass
y = log(y+0.0000001); % prevent log of zero
y = filter(bbd_last(j,:),abd_last(j,:),y);
% step 6: decimation from 20khz to 100hz ( 10ms/feature frame)
% time_freq(:,j) = y1(1:200:length(y1)); % for tidigit
time_freq(:,j) = y(1:100:length(y)); % for yoho from 8khz to 80hz
end
% step 7: dct, help to reduce dimension and improve about 1%
time_freq = dct(time_freq');
time_freq = time_freq(1:9,:);