⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snd_peak_metrics.m

📁 我认为很不错的语音处理的matlab源代码
💻 M
📖 第 1 页 / 共 2 页
字号:
function [metrics, metric_str, metric_units, AHAAH_str, round_kind, round_digits]=snd_peak_metrics(SP, Fs, indices2, num_pts_per_pk_intrl, N, min_f, max_f, ear_model)
% % snd_peak_metrics: Calculates impulsive sound metrics including Nth octave band peak levels 
% % 
% % Syntax:  
% % 
% % [metrics]=snd_peak_metrics(SP, Fs, indices2, num_pts_per_pk_intrl, N, min_f, max_f);
% % 
% % ********************************************************************
% % 
% % Description 
% % 
% % This program calculates metrics for impulsive sound including 
% % peak, peakA, peakC, spl_peak, spl_peakA, spl_peakC, LeqA, LeqA8, LeqC,
% % LeqC8, Leq, Leq8, num_pts_per_pk_intrl/Fs, [a, b, c, d], kurt1,
% % Nth octave band peak levels, and time average sound pressure levels.
% % 
% % The input and output variables are described below
% % 
% % ********************************************************************
% % 
% % Input Variables
% % 
% % SP=randn(10, 50000);    % (Pa) is the time record of the sound pressure
% %                         % default value is rand(1, 50000);.    
% %   
% % Fs=50000;               % sampling rate in Hz.  
% %                         % default value is 100000 Hz.  
% % 
% % indices2=ones(10,1);    % cell array of indices of the peaks.  Use
% %                         % local_peaks.m to find the peaks.  
% %                         % 
% %                         % default value is     
% %                         % indices2=cell(m1, 1);
% %                         %     for e1=1:m1;
% %                         %         indices2{e1, 1}=1;
% %                         %     end
% %                         
% % num_pts_per_pk_intrl=100000;
% %                         % Is the number of data points used to 
% %                         % characterize each impulsive peak  Usually 1 
% %                         % second to 1/2 a second of data points works 
% %                         % well.   default value is 1 second of datda 
% %                         % points or the length of the SP whichever is 
% %                         % shorter.  
% %                         % default is all of the datapoints.
% % 
% % N=3;                    % number of bands per octave
% %                         % Program Now supports Nth octave band filters
% %                         % 
% %                         % N=3;  is one-third octave
% %                         % N=1;  is full octave
% %                         % N=12; is one-twelveth octave
% %                         % default is 3;
% % 
% % min_f=200;              % (Hz) this is the center frequency of the 
% %                         % lowest frequency to analyze with the 
% %                         % third octave peaks.  
% %                         % default is 200;
% % 
% % max_f=20000;            % (Hz) this is the center frequency of the 
% %                         % highest frequency to analyze with the 
% %                         % third octave peaks.  
% %                         % default is 20000;
% % 
% % ear_model=ones(size(SP, 1));    % Not Supported
% %                                 % AHAAH Model is not Currently
% %                                 % Available.  
% %                                 % 
% %                                 % ear-model is a vector of integers.  
% %                                 % this vector specifies which transfer
% %                                 % function the ahaah model will compute
% %                                 % each of the transfer functions starts
% %                                 % with part of the ear and finishes at 
% %                                 % the hair cells.  
% %                                 % 
% %                                 % 1 outer ear to hair cell
% %                                 % 2 middle ear to hair cell
% %                                 % 3 inner ear to hair cell
% %
% % 
% % ********************************************************************
% %
% % Output Variables
% % 
% % metrics includes all of the sound pressure metrics calculated by this 
% %      program  the metrics are described below
% % 
% %      There are 20 metrics + the third octave band metrics + Ahaaha 
% %      Warned and Unwarned will be added soon.  
% % 
% %      'Peak Index',          (index),
% %      'Peak Time',           (s)
% % 
% %      The Peak Amplitude Pressure is recorded in Pa with the metric 
% %      names
% %      'Peak Pres Linear',    (Pa)
% %      'Peak Pres A-Weight'   (Pa)
% %      'Peak Pres C-Weight'   (Pa)
% % 
% %      The Peak Level Pressure is recorded in Pa with the metric names
% %      'Peak Level Linear'    (dB)
% %      'Peak Level A-Weight'  (dB)
% %      'Peak Level C-Weight'  (dB)
% % 
% %      The Time Avereaged Pressure Level is recorded in dB with the 
% %      metric names
% %      'LeqA'                 (dB)
% %      'LeqA8'                (dB)
% %      'LeqC'                 (dB)
% %      'LeqC8'                (dB)
% %      'Leq'                  (dB)
% %      'Leq8'                 (dB)
% % 
% %      The total time span of the data points used to characterize the 
% %      impulse is recorded in (s) with the metric name  
% %      'Time Span'            (s)
% % 
% %      The Impulsive time durations are recorded in (s) with the 
% %      metric names
% %      'A-Duration'           (s) 
% %      'B-Duration'           (s)
% %      'C-Duration'           (s)
% %      'D-Duration'           (s)
% % 
% %      'Kurtosis'             (unitless)
% % 
% %      Nth octave peaks       (dB) from min_f to max_f (Hz) 
% % 
% %      Nth octave levels      (dB) from min_f to max_f (Hz) 
% % 
% % 
% %      AHAAH Model is not currently Available.  
% %      Ahahha model selected model type for each channel units are in 
% %      Auditory Hazard Units (AHU)
% % 
% %      AHAAH_str is a cell array of strings of size [num_channels, 1].  
% %      Each cell describes which the contents of  
% % 
% %                         
% % round_kind      % Array of values one element for the rta array
% %                 % and one element for each varargin array
% %                 % (see example)
% %                 % 1 round to specified number of significant
% %                 % digits
% %                 %
% %                 % 0 round to specified digits place
% %
% % round_digits    % Array of values one element for the rta array
% %                 % and one element for each varargin array
% %                 % (see example)% Type of rounding depends on round_kind
% %                 %
% %                 % if round_kind==1 number of significant digits
% %                 % if round_kind==0 specified digits place
% %
% % 
% % ********************************************************************
% % 
% % Ahaah Note:
% % 
% % The Ahaah model is a lumped parameter model of how the human hearing 
% % mechanism works from the outer ear to the inner ear hair cell
% % stimulations. 
% % 
% % Dick Price and Joel Calb co-invented the model in the 1980's.
% % There research was funded by the US Army.
% % 
% % ********************************************************************
% %
% 
% Example='';
% m1=10; n1=50000;
% SP=randn(m1, n1);
% Fs=50000;  
% indices2=cell(m1, 1);
% for e1=1:m1;
%    indices2{e1, 1}=1;
% end
% num_pts_per_pk_intrl=n1;
% N=3;
% min_f=200;
% max_f=20000;
% ear_model=[1,2,3,1,2,3,1,2,3,1];
% 
% [metrics]=snd_peak_metrics(SP, Fs, indices2, num_pts_per_pk_intrl, N, ...
% min_f, max_f, ear_model);
% 
% Fs_SP=100000; fc=1000; td=1; tau=0.01; delay=0.1; A1=8; A2=21;
% [SP1, t]=analytic_impulse(Fs_SP, fc, td, tau, delay, A1, 10*A2);
% [bb ix]=max(abs(SP1));
% num_pts_per_pk_intrl=100000; N=3; min_f=200; max_f=20000; ear_model=1;
% [metrics, metric_str, metric_units, AHAAH_str]=snd_peak_metrics(SP1, Fs_SP, {ix}, num_pts_per_pk_intrl, N, min_f, max_f, ear_model);
% 
% %
% % ********************************************************************
% % 
% % 
% % Subprograms
% % 
% % 
% % 
% % List of Dependent Subprograms for 
% % snd_peak_metrics
% % 
% % 
% % Program Name   Author   FEX ID#
% %  1) A_duration		
% %  2) abcd_durations		
% %  3) ACdsgn		
% %  4) ACweight_time_filter		
% %  5) analytic_impulse		
% %  6) B_duration		
% %  7) C_duration		
% %  8) convert_double		
% %  9) D_duration		
% % 10) estimatenoise		John D'Errico		16683	
% % 11) filter_settling_data		
% % 12) findextrema		Schuberth Schuberth		3586	
% % 13) geomean2		
% % 14) get_p_q		
% % 15) kurtosis2		
% % 16) Leq_all_calc		
% % 17) LMS_trim		
% % 18) LMTSregor		
% % 19) m_round		
% % 20) moving		Aslak Grinsted		8251	
% % 21) nth_freq_band		
% % 22) Nth_oct_time_filter2		
% % 23) Nth_octdsgn		
% % 24) pow10_round		
% % 25) rand_int		
% % 26) sd_round		
% % 27) sub_mean		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -