tomwalters@0: % Equalizing Signal RMS Level to the Level for MeddisHairCell tomwalters@0: % Irino, T. tomwalters@0: % Created: 9 Jun. 2004 tomwalters@0: % Modified: 9 Jun. 2004 tomwalters@0: % tomwalters@0: % function [SndEqM, AmpdB] = Eqlz2MeddisHCLevel(Snd,fs,OutLeveldB); tomwalters@0: % INPUT Snd: tomwalters@0: % fs: sampling frequency tomwalters@0: % OutLeveldB : Output level (default: 50 dB SPL) tomwalters@0: % tomwalters@0: % OUTPUT SndEq: Equalized Sound (rms value of 1 is 30 dB SPL) tomwalters@0: % AmpdB: 3 values in dB tomwalters@0: % [OutLevel, Compensation value, SourceLevel] tomwalters@0: % tomwalters@0: % Ref: Meddis (1986), JASA, 79(3),pp.702-711. tomwalters@0: % tomwalters@0: % rms(s(t)) == sqrt(mean(s.^2)) == 1 --> 30 dB SPL tomwalters@0: % rms(s(t)) == sqrt(mean(s.^2)) == 10 --> 50 dB SPL tomwalters@0: % rms(s(t)) == sqrt(mean(s.^2)) == 100 --> 70 dB SPL tomwalters@0: % tomwalters@0: function [SndEqM, AmpdB] = Eqlz2MeddisHCLevel(Snd,fs,OutLeveldB); tomwalters@0: tomwalters@0: if nargin < 2, help Eqlz2MeddisHCLevel; end; tomwalters@0: if nargin < 3, OutLeveldB = []; end; tomwalters@0: if length(OutLeveldB) == 0, OutLeveldB = 50; end; % for speech tomwalters@0: if nargin < 4, Method = 'Peak'; end; tomwalters@0: tomwalters@0: SourceLevel = sqrt(mean(Snd.^2))*10^(30/20); % level in terms of Meddis Level tomwalters@0: tomwalters@0: Amp = (10^(OutLeveldB/20))/SourceLevel; tomwalters@0: SndEqM = Amp * Snd; tomwalters@0: tomwalters@0: AmpdB = [OutLeveldB 20*log10([Amp, SourceLevel])];