tomwalters@0: % tomwalters@0: % Correction of ELC, MAF, MAP tomwalters@0: % IRINO Toshio tomwalters@0: % 18 Mar 96 tomwalters@0: % 29 Aug 96 renamed AFShapeCrct -> OutMidCrct tomwalters@0: % 14 May 97 option of Direct Output tomwalters@0: % tomwalters@0: % It produces interpolated points for the ELC/MAF/MAP correction. tomwalters@0: % tomwalters@0: % Reference: tomwalters@0: % Glassberg and Moore (1990) tomwalters@0: % "Derivation of auditory filter shapes from notched noise data" tomwalters@0: % Hearing Research, 47 , pp.103-138. tomwalters@0: % tomwalters@0: % function [CrctLinPwr, frqNpnts, CrctdB] = OutMidCrct(StrCrct,Npnts,SR); tomwalters@0: % INPUT StrCrct: String for Correction ELC/MAF/MAP tomwalters@0: % Npnts: Number of data points, if zero, then direct out. tomwalters@0: % SR: Sampling Rate tomwalters@0: % SwPlot: Switch for plot tomwalters@0: % OUTPUT CrctLinPwr : Correction value in LINEAR POWER tomwalters@0: % frqNpnts: Corresponding Frequency at the data point tomwalters@0: % CrctdB: Correction value in dB tomwalters@0: % tomwalters@0: function [CrctLinPwr, frqNpnts, CrctdB] = OutMidCrct(StrCrct,Npnts,SR,SwPlot); tomwalters@0: tomwalters@0: if nargin < 1, help OutMidCrct; end; tomwalters@0: if nargin < 2, Npnts = 0; end; tomwalters@0: if nargin < 3, SR = 32000; end; tomwalters@0: if nargin < 4, SwPlot = 1; end; tomwalters@0: tomwalters@0: f1 = [ 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, ... tomwalters@0: 125, 150, 177, 200, 250, 300, 350, 400, 450, 500, 550, ... tomwalters@0: 600, 700, 800, 900, 1000, 1500, 2000, 2500, 2828, 3000, ... tomwalters@0: 3500, 4000, 4500, 5000, 5500, 6000, 7000, 8000, 9000, 10000, ... tomwalters@0: 12748, 15000]; tomwalters@0: tomwalters@0: ELC = [ 31.8, 26.0, 21.7, 18.8, 17.2, 15.4, 14.0, 12.6, 11.6, 10.6, ... tomwalters@0: 9.2, 8.2, 7.7, 6.7, 5.3, 4.6, 3.9, 2.9, 2.7, 2.3, ... tomwalters@0: 2.2, 2.3, 2.5, 2.7, 2.9, 3.4, 3.9, 3.9, 3.9, 2.7, ... tomwalters@0: 0.9, -1.3, -2.5, -3.2, -4.4, -4.1, -2.5, -0.5, 2.0, 5.0, ... tomwalters@0: 10.2, 15.0, 17.0, 15.5, 11.0, 22.0]; tomwalters@0: tomwalters@0: MAF = [ 73.4, 65.2, 57.9, 52.7, 48.0, 45.0, 41.9, 39.3, 36.8, 33.0, ... tomwalters@0: 29.7, 27.1, 25.0, 22.0, 18.2, 16.0, 14.0, 11.4, 9.2, 8.0, ... tomwalters@0: 6.9, 6.2, 5.7, 5.1, 5.0, 5.0, 4.4, 4.3, 3.9, 2.7, ... tomwalters@0: 0.9, -1.3, -2.5, -3.2, -4.4, -4.1, -2.5, -0.5, 2.0, 5.0, ... tomwalters@0: 10.2, 15.0, 17.0, 15.5, 11.0, 22.0]; tomwalters@0: tomwalters@0: f2 = [ 125, 250, 500, 1000, 1500, 2000, 3000, ... tomwalters@0: 4000, 6000, 8000,10000,12000,14000,16000]; tomwalters@0: MAP = [ 30.0, 19.0, 12.0, 9.0, 11.0, 16.0, 16.0, ... tomwalters@0: 14.0, 14.0, 9.9, 24.7, 32.7, 44.1, 63.7]; tomwalters@0: tomwalters@0: frqTbl = []; tomwalters@0: CrctTbl = []; tomwalters@0: if length(StrCrct)==3 tomwalters@0: if strcmp(upper(StrCrct(1:3)),'ELC'), frqTbl = f1'; CrctTbl = ELC'; tomwalters@0: elseif strcmp(upper(StrCrct(1:3)),'MAF'), frqTbl = f1'; CrctTbl = MAF'; tomwalters@0: elseif strcmp(upper(StrCrct(1:3)),'MAP'), frqTbl = f2'; CrctTbl = MAP'; tomwalters@0: else error('Specifiy correction: ELC / MAF / MAP or NO correction.'); tomwalters@0: end; tomwalters@0: elseif length(StrCrct)~=2, tomwalters@0: error('Specifiy correction: ELC / MAF / MAP or NO correction.'); tomwalters@0: end; tomwalters@0: tomwalters@0: str1 = ''; tomwalters@0: if Npnts <= 0, tomwalters@0: str1 = 'No interpolation. Output original table.'; tomwalters@0: frqNpnts = frqTbl; tomwalters@0: CrctdB = CrctTbl; tomwalters@0: else tomwalters@0: frqNpnts = (0:Npnts-1)'/Npnts * SR/2; tomwalters@0: if strcmp(upper(StrCrct(1:2)), 'NO'), tomwalters@0: CrctdB = zeros(size(frqNpnts)); tomwalters@0: else tomwalters@0: str1 = 'Spline interpolated value in equal frequency spacing.'; tomwalters@0: CrctdB = spline(frqTbl,CrctTbl,frqNpnts); tomwalters@0: end; tomwalters@0: end; tomwalters@0: tomwalters@0: if SwPlot == 1, tomwalters@0: disp(['*** Outer/Middle Ear Transfer Function ( ' ... tomwalters@0: upper(StrCrct) ' Correction ) ***']); tomwalters@0: disp(str1); tomwalters@0: plot(frqTbl,CrctTbl,frqNpnts,CrctdB,'o'); tomwalters@0: end; tomwalters@0: tomwalters@0: CrctLinPwr = 10.^(-CrctdB/10); % in Linear Power tomwalters@0: tomwalters@0: