Mercurial > hg > camir-aes2014
comparison toolboxes/MIRtoolbox1.3.2/AuditoryToolbox/ERBFilterBank.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function output = ERBFilterBank(x, fcoefs) | |
2 % function output = ERBFilterBank(x, fcoefs) | |
3 % Process an input waveform with a gammatone filter bank. This function | |
4 % takes a single sound vector, and returns an array of filter outputs, one | |
5 % channel per row. | |
6 % | |
7 % The fcoefs parameter, which completely specifies the Gammatone filterbank, | |
8 % should be designed with the MakeERBFilters function. If it is omitted, | |
9 % the filter coefficients are computed for you assuming a 22050Hz sampling | |
10 % rate and 64 filters regularly spaced on an ERB scale from fs/2 down to 100Hz. | |
11 % | |
12 | |
13 % Malcolm Slaney @ Interval, June 11, 1998. | |
14 % (c) 1998 Interval Research Corporation | |
15 % Thanks to Alain de Cheveigne' for his suggestions and improvements. | |
16 | |
17 if nargin < 1 | |
18 error('Syntax: output_array = ERBFilterBank(input_vector[, fcoefs]);'); | |
19 end | |
20 | |
21 if nargin < 2 | |
22 fcoefs = MakeERBFilters(22050,64,100); | |
23 end | |
24 | |
25 if size(fcoefs,2) ~= 10 | |
26 error('fcoefs parameter passed to ERBFilterBank is the wrong size.'); | |
27 end | |
28 | |
29 A0 = fcoefs(:,1); | |
30 A11 = fcoefs(:,2); | |
31 A12 = fcoefs(:,3); | |
32 A13 = fcoefs(:,4); | |
33 A14 = fcoefs(:,5); | |
34 A2 = fcoefs(:,6); | |
35 B0 = fcoefs(:,7); | |
36 B1 = fcoefs(:,8); | |
37 B2 = fcoefs(:,9); | |
38 gain= fcoefs(:,10); | |
39 | |
40 output = zeros(size(gain,1), length(x)); | |
41 for chan = 1: size(gain,1) | |
42 y1=filter([A0(chan)/gain(chan) A11(chan)/gain(chan) ... | |
43 A2(chan)/gain(chan)], ... | |
44 [B0(chan) B1(chan) B2(chan)], x); | |
45 y2=filter([A0(chan) A12(chan) A2(chan)], ... | |
46 [B0(chan) B1(chan) B2(chan)], y1); | |
47 y3=filter([A0(chan) A13(chan) A2(chan)], ... | |
48 [B0(chan) B1(chan) B2(chan)], y2); | |
49 y4=filter([A0(chan) A14(chan) A2(chan)], ... | |
50 [B0(chan) B1(chan) B2(chan)], y3); | |
51 output(chan, :) = y4; | |
52 end | |
53 | |
54 if 0 | |
55 semilogx((0:(length(x)-1))*(fs/length(x)),20*log10(abs(fft(output)))); | |
56 end |