📄 readme.txt
字号:
Last Modified on 19 January 2009
Created by Edward L. Zechmann
The main program is Main_sound
Main_sound prompts the user to input all of the information
to identify and characterize impulsive noise from time recordings.
Additionally a summary table of impulisve noise metrics can be written to a file.
Impulsive_Noise_Meter controls the flow of data for processing all of the files.
make_summary_impls_stats_table makes the summary table.
These programs were written by Edward L. Zechmann for the purposes of
identifying impulsive noise peaks and characterizing them with impulsive
noise metrics. William Murphy and Chucri Kardous wrote the first version
of this program.
local_peaks.m is the impulsive peak finder.
plot_peaks.m plots the time record and indicates the impulsive peaks with black circles.
snd_peak_metrics cacualtes all of the impulsive noise metrics.
The following list of programs can be run separately.
Leq_all_calc.m % Calculates the A-weighted level and other data
Aweight_time_filter.m % applies the A-weighting filter to the time record
Cweight_time_filter.m % applies the C-weighting filter to the time record
Nth_oct_time_filter2.m
m_round
abcd_durations.m % Calculates the A, B, C, and D durations
A_duration.m % Calculates the A-duration
B_duration.m % Calculates the B-duration
C_duration.m % Calculates the C-duration
D_duration.m % Calculates the D-duration
kurtosis2.m % Calculates the kurtosis metric
data_outliers3.m % Identifies and removes outliers and calculates
% descriptive statistics of the metrics.
% This would be difficult to run but possible.
Four examples show how to use the Main_Sound and Impulsive_Noise_Meter.
Main_Sound can also calculate a summary table of metrics
see make_summary_impls_stats_table.m.
% It saves data to several files
default_data_file.mat is a matlab data file storing the sound data
default_data_file.wav is wave file storing a sound data record
fileout.txt stores the sttistical analysis of the impulsive noise metrics
fileout.mat stores the processed data
Copy below this line to the next break line and paste in the matlab command line
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example='1';
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, A2);
Fs_SP=100000; fc=1000; td=1; tau=0.1; delay=0.1; A1=2; A2=22;
[SP2, t]=analytic_impulse(Fs_SP, fc, td, tau, delay, A1, A2);
Fs_SP=100000; fc=1000; td=2; tau=0.4; delay=0.1; A1=2; A2=17;
[SP3, t]=analytic_impulse(Fs_SP, fc, td, tau, delay, A1, A2);
Fs_SP=100000; fc=2000; td=1; tau=0.1; delay=0.1; A1=8; A2=15;
[SP4, t]=analytic_impulse(Fs_SP, fc, td, tau, delay, A1, A2);
SP=[[0.9*SP4 SP1 0.3*SP3 SP2 0.5*SP4 0.2*SP1 SP3 5*SP2];...
[SP1 0.7*SP4 10*SP2 SP3 0.4*SP2 0.5*SP3 SP1 1*SP4];...
[SP3 0.2*SP1 0.5*SP4 2*SP2 0.4*SP2 0.7*SP3 0.3*SP1 10*SP4];...
[SP1 0.7*SP2 0.3*SP3 SP4 0.4*SP1 10*SP2 SP3 1*SP4]];
%
% simulate 8 impulses in 4 microphones with different time records
%
% The process of making the example data added jump discontinuities to the
% data and the dicontinuities can be removed with the following code
[buf, SP]=sub_mean(SP, Fs_SP, 2000);
% % save the SP data variable to a matfile data file
save('default_data_file.mat', 'SP', 'Fs_SP');
% % save the data to a wav file
cf=1/(10*max(max(max(abs(SP)))));
[pp, buf, rdr]=sd_round(cf, 3);
numstr=eval(['sprintf( ', ' ''%9.', num2str(rdr), 'f''', ', pp )']);
fprintf(1, '%s\r', ['When Prompted use the calibration factor ', numstr]);
wavwrite(cf*SP', Fs_SP, 16, 'default_data_file.wav');
%
% Run the Main_Sound just respond to the prompts!
%
Main_Sound;
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example='2';
%
% Try to run the Impulsive_Noise_Meter form the Command Line
%
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, A2);
Fs_SP=100000; fc=1000; td=1; tau=0.1; delay=0.1; A1=2; A2=22;
[SP2, t]=analytic_impulse(Fs_SP, fc, td, tau, delay, A1, A2);
Fs_SP=100000; fc=1000; td=2; tau=0.4; delay=0.1; A1=2; A2=17;
[SP3, t]=analytic_impulse(Fs_SP, fc, td, tau, delay, A1, A2);
Fs_SP=100000; fc=2000; td=1; tau=0.1; delay=0.1; A1=8; A2=15;
[SP4, t]=analytic_impulse(Fs_SP, fc, td, tau, delay, A1, A2);
SP=[[0.9*SP4 SP1 0.3*SP3 SP2 0.5*SP4 0.2*SP1 SP3 5*SP2];...
[SP1 0.7*SP4 10*SP2 SP3 0.4*SP2 0.5*SP3 SP1 1*SP4];...
[SP3 0.2*SP1 0.5*SP4 2*SP2 0.4*SP2 0.7*SP3 0.3*SP1 10*SP4];...
[SP1 0.7*SP2 0.3*SP3 SP4 0.4*SP1 10*SP2 SP3 1*SP4]];
%
% simulate 8 impulses in 4 microphones with different time records
%
% The process of making the example data added jump discontinuities to the
% data and the dicontinuities can be removed with the following code
[buf, SP]=sub_mean(SP, Fs_SP, 2000);
% % save the SP data variable to a matfile data file
save('default_data_file.mat', 'SP', 'Fs_SP');
% % save the data to a wav file
cf=1/(10*max(max(max(abs(SP)))));
[pp, buf, rdr]=sd_round(cf, 3);
numstr=eval(['sprintf( ', ' ''%9.', num2str(rdr), 'f''', ', pp )']);
fprintf(1, '%s\r', ['When Prompted use the calibration factor ', numstr]);
wavwrite(cf*SP', Fs_SP, 16, 'default_data_file.wav');
filenamesin={'default_data_file.mat', 'default_data_file.wav'};
fileout_txt='fileout.txt';
fileout_struct='fileout.mat';
save_struct=1;
peak_interval=0.5;
make_plot=1;
save_plot=1;
fig_format=[1];
Tool_Name='Hammer';
same_ylim=1;
min_peak=30;
sar=1;
plot_str={'Protected', 'Unprotected'};
Align_peaks=2;
portrait_landscape=1;
peak_alignment_tol=0.25;
percent1=[];
exhaust_cycle=[];
sod=0;
[s]=Impulsive_Noise_Meter(filenamesin, fileout_txt, fileout_struct, save_struct, peak_interval, make_plot, save_plot, fig_format, Tool_Name, same_ylim, min_peak, sar, plot_str, Align_peaks, portrait_landscape, peak_alignment_tol, percent1, exhaust_cycle, sod );
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example='3';
%
% Try to analyze the Guns_example.wav using the command line with
% the Impulsive_Noise_Meter
%
% When prompted use a calibration factor of 0.0001
%
% Note that mic 2 does not have adequate dynamic resolution
filenamesin={'Guns_example.wav'};
fileout_txt='fileout.txt';
fileout_struct='fileout.mat';
save_struct=1;
peak_interval=0.1;
make_plot=1;
save_plot=1;
fig_format=[1];
Tool_Name='Guns';
same_ylim=1;
min_peak=30;
sar=1;
plot_str={'Unprotected', 'Protected'};
Align_peaks=1;
portrait_landscape=1;
peak_alignment_tol=0.25;
percent1=[];
exhaust_cycle=[];
sod=0;
[s]=Impulsive_Noise_Meter(filenamesin, fileout_txt, fileout_struct, save_struct, peak_interval, make_plot, save_plot, fig_format, Tool_Name, same_ylim, min_peak, sar, plot_str, Align_peaks, portrait_landscape, peak_alignment_tol, percent1, exhaust_cycle, sod )
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example='4';
%
% Run the Main_Sound and open the Guns_example.wav this time!
%
Main_Sound;
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -