tomwalters@0
|
1 %
|
tomwalters@0
|
2 % Correction of ELC, MAF, MAP
|
tomwalters@0
|
3 % IRINO Toshio
|
tomwalters@0
|
4 % 18 Mar 96
|
tomwalters@0
|
5 % 29 Aug 96 renamed AFShapeCrct -> OutMidCrct
|
tomwalters@0
|
6 % 14 May 97 option of Direct Output
|
tomwalters@0
|
7 %
|
tomwalters@0
|
8 % It produces interpolated points for the ELC/MAF/MAP correction.
|
tomwalters@0
|
9 %
|
tomwalters@0
|
10 % Reference:
|
tomwalters@0
|
11 % Glassberg and Moore (1990)
|
tomwalters@0
|
12 % "Derivation of auditory filter shapes from notched noise data"
|
tomwalters@0
|
13 % Hearing Research, 47 , pp.103-138.
|
tomwalters@0
|
14 %
|
tomwalters@0
|
15 % function [CrctLinPwr, frqNpnts, CrctdB] = OutMidCrct(StrCrct,Npnts,SR);
|
tomwalters@0
|
16 % INPUT StrCrct: String for Correction ELC/MAF/MAP
|
tomwalters@0
|
17 % Npnts: Number of data points, if zero, then direct out.
|
tomwalters@0
|
18 % SR: Sampling Rate
|
tomwalters@0
|
19 % SwPlot: Switch for plot
|
tomwalters@0
|
20 % OUTPUT CrctLinPwr : Correction value in LINEAR POWER
|
tomwalters@0
|
21 % frqNpnts: Corresponding Frequency at the data point
|
tomwalters@0
|
22 % CrctdB: Correction value in dB
|
tomwalters@0
|
23 %
|
tomwalters@0
|
24 function [CrctLinPwr, frqNpnts, CrctdB] = OutMidCrct(StrCrct,Npnts,SR,SwPlot);
|
tomwalters@0
|
25
|
tomwalters@0
|
26 if nargin < 1, help OutMidCrct; end;
|
tomwalters@0
|
27 if nargin < 2, Npnts = 0; end;
|
tomwalters@0
|
28 if nargin < 3, SR = 32000; end;
|
tomwalters@0
|
29 if nargin < 4, SwPlot = 1; end;
|
tomwalters@0
|
30
|
tomwalters@0
|
31 f1 = [ 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, ...
|
tomwalters@0
|
32 125, 150, 177, 200, 250, 300, 350, 400, 450, 500, 550, ...
|
tomwalters@0
|
33 600, 700, 800, 900, 1000, 1500, 2000, 2500, 2828, 3000, ...
|
tomwalters@0
|
34 3500, 4000, 4500, 5000, 5500, 6000, 7000, 8000, 9000, 10000, ...
|
tomwalters@0
|
35 12748, 15000];
|
tomwalters@0
|
36
|
tomwalters@0
|
37 ELC = [ 31.8, 26.0, 21.7, 18.8, 17.2, 15.4, 14.0, 12.6, 11.6, 10.6, ...
|
tomwalters@0
|
38 9.2, 8.2, 7.7, 6.7, 5.3, 4.6, 3.9, 2.9, 2.7, 2.3, ...
|
tomwalters@0
|
39 2.2, 2.3, 2.5, 2.7, 2.9, 3.4, 3.9, 3.9, 3.9, 2.7, ...
|
tomwalters@0
|
40 0.9, -1.3, -2.5, -3.2, -4.4, -4.1, -2.5, -0.5, 2.0, 5.0, ...
|
tomwalters@0
|
41 10.2, 15.0, 17.0, 15.5, 11.0, 22.0];
|
tomwalters@0
|
42
|
tomwalters@0
|
43 MAF = [ 73.4, 65.2, 57.9, 52.7, 48.0, 45.0, 41.9, 39.3, 36.8, 33.0, ...
|
tomwalters@0
|
44 29.7, 27.1, 25.0, 22.0, 18.2, 16.0, 14.0, 11.4, 9.2, 8.0, ...
|
tomwalters@0
|
45 6.9, 6.2, 5.7, 5.1, 5.0, 5.0, 4.4, 4.3, 3.9, 2.7, ...
|
tomwalters@0
|
46 0.9, -1.3, -2.5, -3.2, -4.4, -4.1, -2.5, -0.5, 2.0, 5.0, ...
|
tomwalters@0
|
47 10.2, 15.0, 17.0, 15.5, 11.0, 22.0];
|
tomwalters@0
|
48
|
tomwalters@0
|
49 f2 = [ 125, 250, 500, 1000, 1500, 2000, 3000, ...
|
tomwalters@0
|
50 4000, 6000, 8000,10000,12000,14000,16000];
|
tomwalters@0
|
51 MAP = [ 30.0, 19.0, 12.0, 9.0, 11.0, 16.0, 16.0, ...
|
tomwalters@0
|
52 14.0, 14.0, 9.9, 24.7, 32.7, 44.1, 63.7];
|
tomwalters@0
|
53
|
tomwalters@0
|
54 frqTbl = [];
|
tomwalters@0
|
55 CrctTbl = [];
|
tomwalters@0
|
56 if length(StrCrct)==3
|
tomwalters@0
|
57 if strcmp(upper(StrCrct(1:3)),'ELC'), frqTbl = f1'; CrctTbl = ELC';
|
tomwalters@0
|
58 elseif strcmp(upper(StrCrct(1:3)),'MAF'), frqTbl = f1'; CrctTbl = MAF';
|
tomwalters@0
|
59 elseif strcmp(upper(StrCrct(1:3)),'MAP'), frqTbl = f2'; CrctTbl = MAP';
|
tomwalters@0
|
60 else error('Specifiy correction: ELC / MAF / MAP or NO correction.');
|
tomwalters@0
|
61 end;
|
tomwalters@0
|
62 elseif length(StrCrct)~=2,
|
tomwalters@0
|
63 error('Specifiy correction: ELC / MAF / MAP or NO correction.');
|
tomwalters@0
|
64 end;
|
tomwalters@0
|
65
|
tomwalters@0
|
66 str1 = '';
|
tomwalters@0
|
67 if Npnts <= 0,
|
tomwalters@0
|
68 str1 = 'No interpolation. Output original table.';
|
tomwalters@0
|
69 frqNpnts = frqTbl;
|
tomwalters@0
|
70 CrctdB = CrctTbl;
|
tomwalters@0
|
71 else
|
tomwalters@0
|
72 frqNpnts = (0:Npnts-1)'/Npnts * SR/2;
|
tomwalters@0
|
73 if strcmp(upper(StrCrct(1:2)), 'NO'),
|
tomwalters@0
|
74 CrctdB = zeros(size(frqNpnts));
|
tomwalters@0
|
75 else
|
tomwalters@0
|
76 str1 = 'Spline interpolated value in equal frequency spacing.';
|
tomwalters@0
|
77 CrctdB = spline(frqTbl,CrctTbl,frqNpnts);
|
tomwalters@0
|
78 end;
|
tomwalters@0
|
79 end;
|
tomwalters@0
|
80
|
tomwalters@0
|
81 if SwPlot == 1,
|
tomwalters@0
|
82 disp(['*** Outer/Middle Ear Transfer Function ( ' ...
|
tomwalters@0
|
83 upper(StrCrct) ' Correction ) ***']);
|
tomwalters@0
|
84 disp(str1);
|
tomwalters@0
|
85 plot(frqTbl,CrctTbl,frqNpnts,CrctdB,'o');
|
tomwalters@0
|
86 end;
|
tomwalters@0
|
87
|
tomwalters@0
|
88 CrctLinPwr = 10.^(-CrctdB/10); % in Linear Power
|
tomwalters@0
|
89
|
tomwalters@0
|
90
|