annotate aim-mat/modules/bmm/dcgc/Eqlz2MeddisHCLevel.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 74dedb26614d
children
rev   line source
tomwalters@0 1 % Equalizing Signal RMS Level to the Level for MeddisHairCell
tomwalters@0 2 % Irino, T.
tomwalters@0 3 % Created: 9 Jun. 2004
tomwalters@0 4 % Modified: 9 Jun. 2004
tomwalters@0 5 %
tomwalters@0 6 % function [SndEqM, AmpdB] = Eqlz2MeddisHCLevel(Snd,fs,OutLeveldB);
tomwalters@0 7 % INPUT Snd:
tomwalters@0 8 % fs: sampling frequency
tomwalters@0 9 % OutLeveldB : Output level (default: 50 dB SPL)
tomwalters@0 10 %
tomwalters@0 11 % OUTPUT SndEq: Equalized Sound (rms value of 1 is 30 dB SPL)
tomwalters@0 12 % AmpdB: 3 values in dB
tomwalters@0 13 % [OutLevel, Compensation value, SourceLevel]
tomwalters@0 14 %
tomwalters@0 15 % Ref: Meddis (1986), JASA, 79(3),pp.702-711.
tomwalters@0 16 %
tomwalters@0 17 % rms(s(t)) == sqrt(mean(s.^2)) == 1 --> 30 dB SPL
tomwalters@0 18 % rms(s(t)) == sqrt(mean(s.^2)) == 10 --> 50 dB SPL
tomwalters@0 19 % rms(s(t)) == sqrt(mean(s.^2)) == 100 --> 70 dB SPL
tomwalters@0 20 %
tomwalters@0 21 function [SndEqM, AmpdB] = Eqlz2MeddisHCLevel(Snd,fs,OutLeveldB);
tomwalters@0 22
tomwalters@0 23 if nargin < 2, help Eqlz2MeddisHCLevel; end;
tomwalters@0 24 if nargin < 3, OutLeveldB = []; end;
tomwalters@0 25 if length(OutLeveldB) == 0, OutLeveldB = 50; end; % for speech
tomwalters@0 26 if nargin < 4, Method = 'Peak'; end;
tomwalters@0 27
tomwalters@0 28 SourceLevel = sqrt(mean(Snd.^2))*10^(30/20); % level in terms of Meddis Level
tomwalters@0 29
tomwalters@0 30 Amp = (10^(OutLeveldB/20))/SourceLevel;
tomwalters@0 31 SndEqM = Amp * Snd;
tomwalters@0 32
tomwalters@0 33 AmpdB = [OutLeveldB 20*log10([Amp, SourceLevel])];