wolffd@0: function output = ERBFilterBank(x, fcoefs) wolffd@0: % function output = ERBFilterBank(x, fcoefs) wolffd@0: % Process an input waveform with a gammatone filter bank. This function wolffd@0: % takes a single sound vector, and returns an array of filter outputs, one wolffd@0: % channel per row. wolffd@0: % wolffd@0: % The fcoefs parameter, which completely specifies the Gammatone filterbank, wolffd@0: % should be designed with the MakeERBFilters function. If it is omitted, wolffd@0: % the filter coefficients are computed for you assuming a 22050Hz sampling wolffd@0: % rate and 64 filters regularly spaced on an ERB scale from fs/2 down to 100Hz. wolffd@0: % wolffd@0: wolffd@0: % Malcolm Slaney @ Interval, June 11, 1998. wolffd@0: % (c) 1998 Interval Research Corporation wolffd@0: % Thanks to Alain de Cheveigne' for his suggestions and improvements. wolffd@0: wolffd@0: if nargin < 1 wolffd@0: error('Syntax: output_array = ERBFilterBank(input_vector[, fcoefs]);'); wolffd@0: end wolffd@0: wolffd@0: if nargin < 2 wolffd@0: fcoefs = MakeERBFilters(22050,64,100); wolffd@0: end wolffd@0: wolffd@0: if size(fcoefs,2) ~= 10 wolffd@0: error('fcoefs parameter passed to ERBFilterBank is the wrong size.'); wolffd@0: end wolffd@0: wolffd@0: A0 = fcoefs(:,1); wolffd@0: A11 = fcoefs(:,2); wolffd@0: A12 = fcoefs(:,3); wolffd@0: A13 = fcoefs(:,4); wolffd@0: A14 = fcoefs(:,5); wolffd@0: A2 = fcoefs(:,6); wolffd@0: B0 = fcoefs(:,7); wolffd@0: B1 = fcoefs(:,8); wolffd@0: B2 = fcoefs(:,9); wolffd@0: gain= fcoefs(:,10); wolffd@0: wolffd@0: output = zeros(size(gain,1), length(x)); wolffd@0: for chan = 1: size(gain,1) wolffd@0: y1=filter([A0(chan)/gain(chan) A11(chan)/gain(chan) ... wolffd@0: A2(chan)/gain(chan)], ... wolffd@0: [B0(chan) B1(chan) B2(chan)], x); wolffd@0: y2=filter([A0(chan) A12(chan) A2(chan)], ... wolffd@0: [B0(chan) B1(chan) B2(chan)], y1); wolffd@0: y3=filter([A0(chan) A13(chan) A2(chan)], ... wolffd@0: [B0(chan) B1(chan) B2(chan)], y2); wolffd@0: y4=filter([A0(chan) A14(chan) A2(chan)], ... wolffd@0: [B0(chan) B1(chan) B2(chan)], y3); wolffd@0: output(chan, :) = y4; wolffd@0: end wolffd@0: wolffd@0: if 0 wolffd@0: semilogx((0:(length(x)-1))*(fs/length(x)),20*log10(abs(fft(output)))); wolffd@0: end