tomwalters@0
|
1 % generating function for 'aim-mat'
|
tomwalters@0
|
2 %
|
tomwalters@0
|
3 % (c) 2011, University of Southampton
|
bleeck@3
|
4 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@3
|
5 % download of current version is on the soundsoftware site:
|
bleeck@3
|
6 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@3
|
7 % documentation and everything is on http://www.acousticscale.org
|
tomwalters@0
|
8
|
tomwalters@0
|
9
|
tomwalters@0
|
10 function fr=gen_gtfb(sig,options)
|
tomwalters@0
|
11
|
tomwalters@0
|
12 NumCh=options.nr_channels;
|
tomwalters@0
|
13 fre1=options.lowest_frequency;
|
tomwalters@0
|
14 fre2=options.highest_frequency;
|
tomwalters@0
|
15 FRange = [fre1 fre2];
|
tomwalters@0
|
16
|
tomwalters@0
|
17
|
tomwalters@0
|
18 samplerate=getsr(sig);
|
tomwalters@0
|
19 Snd=getvalues(sig);
|
tomwalters@0
|
20 Snd=Snd'; %- do we need this transpose?
|
tomwalters@0
|
21
|
tomwalters@0
|
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
tomwalters@0
|
23
|
tomwalters@0
|
24 fs = samplerate;
|
tomwalters@0
|
25 NAPparam.cf_afb = [fre1 fre2];
|
tomwalters@0
|
26 cf_afb=NAPparam.cf_afb;
|
tomwalters@0
|
27 NAPparam.SubBase = 0.5;
|
tomwalters@0
|
28
|
tomwalters@0
|
29 %%%%% Outer-Mid Ear Compensation %%%%
|
tomwalters@0
|
30 %CmpnOutMid = OutMidCrctFilt('ELC',fs,0);
|
tomwalters@0
|
31 %Snd_om = filter(CmpnOutMid,1,Snd);
|
tomwalters@0
|
32
|
tomwalters@0
|
33 %we are already applying filter in PCP module
|
tomwalters@0
|
34 Snd_om = Snd; % if unnecessary
|
tomwalters@0
|
35
|
tomwalters@0
|
36
|
tomwalters@0
|
37 %%%%% BMM %%%
|
tomwalters@0
|
38 % disp('*** BMM & NAP Calculation ***');
|
tomwalters@0
|
39 % disp(NAPparam)
|
tomwalters@0
|
40 % tic;
|
tomwalters@0
|
41 Frs = FcNch2EqERB(min(cf_afb),max(cf_afb),NumCh);
|
tomwalters@0
|
42 NAPparam.Frs = Frs;
|
tomwalters@0
|
43 NAPparam.b = options.b; % maah: 1.019; % default gammatone
|
tomwalters@0
|
44
|
tomwalters@0
|
45 % IIR implementation
|
tomwalters@0
|
46 % disp('BMM : Start calculation, Wait a minute');
|
tomwalters@0
|
47 % fcoefs = MakeERBFilters98B(fs,Frs,[],b); % new version
|
tomwalters@0
|
48 % BMM = ERBFilterBank(Snd_om, fcoefs);
|
tomwalters@0
|
49 % disp(['BMM : elapsed_time = ' num2str(toc,3) ' (sec)']);
|
tomwalters@0
|
50
|
tomwalters@0
|
51 % %%%% Lowpass filter for representing Phase-lock property %%%
|
tomwalters@0
|
52 % flpcut = 1200;
|
tomwalters@0
|
53 % [bzLP apLP] = butter(1,flpcut/(fs/2));
|
tomwalters@0
|
54 % bzLP2 = [bzLP(1)^2, 2*bzLP(1)*bzLP(2), bzLP(2)^2];
|
tomwalters@0
|
55 % apLP2 = [apLP(1)^2, 2*apLP(1)*apLP(2), apLP(2)^2];
|
tomwalters@0
|
56
|
tomwalters@0
|
57
|
tomwalters@0
|
58 LenSnd = length(Snd_om);
|
tomwalters@0
|
59 bias = 0.1;
|
tomwalters@0
|
60 waithand=waitbar(0,'generating basilar membrane motion');
|
tomwalters@0
|
61
|
tomwalters@0
|
62 for nch = 1:NumCh
|
tomwalters@0
|
63 if mod(nch,10)==0
|
tomwalters@0
|
64 waitbar(nch/NumCh);
|
tomwalters@0
|
65 end
|
tomwalters@0
|
66 gt = GammaChirp(Frs(nch),fs,4,NAPparam.b,0,0,[],'peak');
|
tomwalters@0
|
67 BMM(nch,:) = fftfilt(gt,Snd_om);
|
tomwalters@0
|
68 end;
|
tomwalters@0
|
69
|
tomwalters@0
|
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
tomwalters@0
|
71 %now we convert all the stuff into the form that aim mat wants it
|
tomwalters@0
|
72 fr=frame(BMM);
|
tomwalters@0
|
73 fr=setsr(fr,samplerate);
|
tomwalters@0
|
74 fr=setstarttime(fr,getminimumtime(sig));
|
tomwalters@0
|
75
|
tomwalters@0
|
76 fr=setcf(fr,Frs);
|
tomwalters@0
|
77
|
tomwalters@0
|
78
|
tomwalters@0
|
79 if ~strcmp(options.do_phase_alignment,'off')
|
tomwalters@0
|
80 fr=phasealign(fr,options);
|
tomwalters@0
|
81 end
|
tomwalters@0
|
82
|
tomwalters@0
|
83
|
tomwalters@0
|
84 close(waithand);
|
tomwalters@0
|
85
|
tomwalters@0
|
86
|
tomwalters@0
|
87
|