forked from ltfat/ltfat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
erbfilters.m
74 lines (72 loc) · 2.54 KB
/
erbfilters.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function [g,a,fc,L]=erbfilters(fs,Ls,varargin)
%ERBFILTERS ERB-spaced filters
% Usage: [g,a,fc,L]=erbfilters(fs,Ls);
% [g,a,fc,L]=erbfilters(fs,Ls,...);
%
% Input parameters:
% fs : Sampling rate (in Hz).
% Ls : Signal length.
% Output parameters:
% g : Cell array of filters.
% a : Downsampling rate for each channel.
% fc : Center frequency of each channel.
% L : Next admissible length suitable for the generated filters.
%
% `[g,a,fc]=erbfilters(fs,Ls)` constructs a set of filters *g* that are
% equidistantly spaced on the ERB-scale (see |freqtoerb|) with bandwidths
% that are proportional to the width of the auditory filters
% |audfiltbw|. The filters are intended to work with signals with a
% sampling rate of *fs*.
%
% Note that this function just forwards the arguments to |audfilters|.
% Please see the help of |audfilters| for more details.
%
% Examples:
% ---------
%
% In the first example, we construct a highly redudant uniform
% filterbank and visualize the result:::
%
% [f,fs]=greasy; % Get the test signal
% [g,a,fc]=erbfilters(fs,length(f),'uniform','M',100);
% c=filterbank(f,g,a);
% plotfilterbank(c,a,fc,fs,90,'audtick');
%
% In the second example, we construct a non-uniform filterbank with
% fractional sampling that works for this particular signal length, and
% test the reconstruction. The plot displays the response of the
% filterbank to verify that the filters are well-behaved both on a
% normal and an ERB-scale. The second plot shows frequency responses of
% filters used for analysis (top) and synthesis (bottom). :::
%
% [f,fs]=greasy; % Get the test signal
% L=length(f);
% [g,a,fc]=erbfilters(fs,L,'fractional');
% c=filterbank(f,{'realdual',g},a);
% r=2*real(ifilterbank(c,g,a));
% norm(f-r)
%
% % Plot the response
% figure(1);
% subplot(2,1,1);
% R=filterbankresponse(g,a,L,fs,'real','plot');
%
% subplot(2,1,2);
% semiaudplot(linspace(0,fs/2,L/2+1),R(1:L/2+1));
% ylabel('Magnitude');
%
% % Plot frequency responses of individual filters
% gd=filterbankrealdual(g,a,L);
% figure(2);
% subplot(2,1,1);
% filterbankfreqz(gd,a,L,fs,'plot','linabs','posfreq');
%
% subplot(2,1,2);
% filterbankfreqz(g,a,L,fs,'plot','linabs','posfreq');
%
%
% See also: audfilters, filterbank, ufilterbank, ifilterbank, ceil23
%
% References: ltfatnote027
% Authors: Peter L. Søndergaard, Zdenek Prusa, Nicki Holighaus
[g,a,fc,L]=audfilters(fs,Ls,varargin{:},'erb');