From ff429d8e300c954a5845ee9cad1a9af185c3678e Mon Sep 17 00:00:00 2001 From: Markus Mueller-Trapet <markus.mueller-trapet@nrc.ca> Date: Fri, 20 Apr 2018 13:14:27 -0400 Subject: [PATCH] added T25 for ASTM measurements --- applications/RoomAcoustics/ita_roomacoustics.m | 2 +- .../RoomAcoustics/ita_roomacoustics_parameters.m | 9 ++++----- .../private/ita_roomacoustics_reverberation_time.m | 12 ++++++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/applications/RoomAcoustics/ita_roomacoustics.m b/applications/RoomAcoustics/ita_roomacoustics.m index b64223d2..459a6240 100644 --- a/applications/RoomAcoustics/ita_roomacoustics.m +++ b/applications/RoomAcoustics/ita_roomacoustics.m @@ -245,7 +245,7 @@ for iCh = 1:nChannels data.timeData = data.timeData(1:nInputSamples(iCh),:); % lundeby parameter - [RT_lundeby PSNR Intersection_Time_Lundeby NoiseLundeby PSPNR] = ita_roomacoustics_reverberation_time_lundeby(data ,'freqRange', freqRange, 'bandsPerOctave', bandsPerOctave, 'plot', sArgs.plotLundebyResults, 'broadbandAnalysis', sArgs.broadbandAnalysis); + [RT_lundeby, PSNR, Intersection_Time_Lundeby, NoiseLundeby, PSPNR] = ita_roomacoustics_reverberation_time_lundeby(data ,'freqRange', freqRange, 'bandsPerOctave', bandsPerOctave, 'plot', sArgs.plotLundebyResults, 'broadbandAnalysis', sArgs.broadbandAnalysis); % copy wanted data in output struct if sArgs.T_Lundeby diff --git a/applications/RoomAcoustics/ita_roomacoustics_parameters.m b/applications/RoomAcoustics/ita_roomacoustics_parameters.m index fcffcbbe..07817a77 100644 --- a/applications/RoomAcoustics/ita_roomacoustics_parameters.m +++ b/applications/RoomAcoustics/ita_roomacoustics_parameters.m @@ -37,7 +37,7 @@ function varargout = ita_roomacoustics_parameters(varargin) %% -defaultPar = struct( 'Reverberation_Times', struct('EDT', true, 'T10', false, 'T15', false, 'T20', true, 'T30', true, 'T40', false, 'T50', false, 'T60', false, 'T_Huszty', false, 'T_Lundeby', false),... +defaultPar = struct( 'Reverberation_Times', struct('EDT', true, 'T10', false, 'T15', false, 'T20', true, 'T25', false, 'T30', true, 'T40', false, 'T50', false, 'T60', false, 'T_Huszty', false, 'T_Lundeby', false),... 'Clarity_and_Definition', struct('C50', false, 'C80',false, 'D50', false ,'D80', false, 'Center_Time', false ), ... 'Others', struct( 'PSNR_Lundeby', false, 'PSPNR_Lundeby', false, 'Intersection_Time_Lundeby', false, 'EDC', false )); @@ -58,15 +58,14 @@ elseif nargin >= 1 && strcmpi('getAvailableParameters',varargin{1} ) if any(idxOfCat) categoryNames = categoryNames(idxOfCat); else - error('second parameter must specify category name. (possible: %sor %s)', sprintf('%s, ', categoryNames{1:end-1}), categoryNames{end}) %#ok<SPERR> + error('second parameter must specify category name. (possible: %sor %s)', sprintf('%s, ', categoryNames{1:end-1}), categoryNames{end}) end end - varargout = []; + varargout = cell(1,1); for iCat = 1:numel(categoryNames) - varargout = [ varargout; fieldnames(defaultPar.(categoryNames{iCat})) ]; %#ok<AGROW> + varargout(1) = {[varargout{1}; fieldnames(defaultPar.(categoryNames{iCat}))]}; end - varargout = {varargout}; % output is one cell return else diff --git a/applications/RoomAcoustics/private/ita_roomacoustics_reverberation_time.m b/applications/RoomAcoustics/private/ita_roomacoustics_reverberation_time.m index 8be7c696..b3bfe6d7 100644 --- a/applications/RoomAcoustics/private/ita_roomacoustics_reverberation_time.m +++ b/applications/RoomAcoustics/private/ita_roomacoustics_reverberation_time.m @@ -38,7 +38,7 @@ function varargout = ita_roomacoustics_reverberation_time(varargin) %% Initialization narginchk(1,24); -sArgs = struct('pos1_ir','itaAudio','shift', true,'calcEdc',true, 'freqRange', ita_preferences('freqRange'), 'bandsPerOctave', ita_preferences('bandsperoctave'), 'intersectionTime', 'itaResult', 'lateRevEstimation', 'itaResult', 'noiseRMS', 'itaResult', 'edcMethod', 'cutWithCorrection', 'plot', false, 'EDT', false, 'T10', false, 'T15', false, 'T20', false, 'T30', false, 'T40', false, 'T50', false, 'T60', false ); +sArgs = struct('pos1_ir','itaAudio','shift', true,'calcEdc',true, 'freqRange', ita_preferences('freqRange'), 'bandsPerOctave', ita_preferences('bandsperoctave'), 'intersectionTime', 'itaResult', 'lateRevEstimation', 'itaResult', 'noiseRMS', 'itaResult', 'edcMethod', 'cutWithCorrection', 'plot', false, 'EDT', false, 'T10', false, 'T15', false, 'T20', false, 'T25', false, 'T30', false, 'T40', false, 'T50', false, 'T60', false ); [ir,sArgs] = ita_parse_arguments(sArgs,varargin); %% Calculation of decay curve - SCHROEDER backwards time integration @@ -54,13 +54,13 @@ else end -parNameCell = {'EDT' 'T10' 'T15' 'T20' 'T30' 'T40' 'T50' 'T60'}; -parameters = struct('high', { 0 -5 -5 -5 -5 -5 -5 -5 }, ... - 'low', { -10 -15 -20 -25 -35 -45 -55 -65 }, ... +parNameCell = {'EDT' 'T10' 'T15' 'T20' 'T25' 'T30' 'T40' 'T50' 'T60'}; +parameters = struct('high', { 0 -5 -5 -5 -5 -5 -5 -5 -5 }, ... + 'low', { -10 -15 -20 -25 -30 -35 -45 -55 -65 }, ... 'name', parNameCell ); -par2calc = [ sArgs.EDT sArgs.T10 sArgs.T15 sArgs.T20 sArgs.T30 sArgs.T40 sArgs.T50 sArgs.T60 ].'; +par2calc = [ sArgs.EDT sArgs.T10 sArgs.T15 sArgs.T20 sArgs.T25 sArgs.T30 sArgs.T40 sArgs.T50 sArgs.T60 ].'; if ~any(par2calc) % if no input parameter => selection of Parameters according to ita_roomacoustics_parameters() par2calc = cell2mat(ita_roomacoustics_parameters(parNameCell{:})); @@ -160,7 +160,7 @@ varargout(1) = {outputStruct}; if nargout >= 2 varargout{2} = edc; end -if nargout >= 3; +if nargout >= 3 varargout{3} = timeVector([firstSample lastSample]); end %end function -- GitLab