Commit bd3313b1 authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter
Browse files

changes to listeningtest stimulus

parent f9ec8ae5
...@@ -48,7 +48,6 @@ classdef itaListeningTestStimulus ...@@ -48,7 +48,6 @@ classdef itaListeningTestStimulus
mHRTF; mHRTF;
mHeadphoneEquilization; mHeadphoneEquilization;
mStimulus; mStimulus;
hrtfmerge;
end end
%% methods %% methods
...@@ -96,7 +95,7 @@ classdef itaListeningTestStimulus ...@@ -96,7 +95,7 @@ classdef itaListeningTestStimulus
% targetCoord.r = 1; % targetCoord.r = 1;
% index = coords.findnearest(targetCoord); % index = coords.findnearest(targetCoord);
% HRTF = this.mHRTF(ceil(index/2)); % HRTF = this.mHRTF(ceil(index/2));
hrtf = this.hrtfmerge.findnearestHRTF(elevation,azimuth); hrtf = this.mHRTF.findnearestHRTF(elevation,azimuth);
HRTF = hrtf.itaHRTF2itaAudio; HRTF = hrtf.itaHRTF2itaAudio;
end end
...@@ -114,19 +113,37 @@ classdef itaListeningTestStimulus ...@@ -114,19 +113,37 @@ classdef itaListeningTestStimulus
result = this.HRTFFile; result = this.HRTFFile;
end end
function this = set.HRTFFile(this,value) function this = set.HRTFFile(this,value)
this.HRTFFile = value;
if isa(value,'itaAudio')
this.HRTFFile = '';
this.mHRTF = itaHRTF(merge(value));
return
end
if isa(value,'itaHRTF')
this.HRTFFile = '';
this.mHRTF = value;
return
end
if ischar(value)
try
this.HRTFFile = value;
% load the HRTF data HRTF = ita_read(value);
HRTF = ita_read(value);
% TODO: normalization catch e
% mergeHRTF = merge(HRTF);
% maxValue = max(max(abs(mergeHRTF.freqData))); end
% for index = 1:length(HRTF)
% HRTF(index).freqData = HRTF(index).freqData./maxValue; return
% % HRTF(index).signalType = 'energy'; end
% end
this.mHRTF = HRTF; error('Not a valid type');
this.hrtfmerge = itaHRTF(merge(this.mHRTF));
end end
...@@ -134,13 +151,27 @@ classdef itaListeningTestStimulus ...@@ -134,13 +151,27 @@ classdef itaListeningTestStimulus
result = this.StimulusFile; result = this.StimulusFile;
end end
function this = set.StimulusFile(this,value) function this = set.StimulusFile(this,value)
this.StimulusFile = value;
% read the simulus file if isa(value,'itaAudio')
this.mStimulus = ita_read(value); this.StimulusFile = '';
this.mStimulus = value;
return
end
% normalize
% this.mStimulus.timeData = this.mStimulus.timeData./max(abs(this.mStimulus.timeData)); if ischar(value)
try
this.StimulusFile = value;
this.mStimulus = ita_read(value);
catch e
end
return
end
error('Not a valid type');
end end
...@@ -148,13 +179,30 @@ classdef itaListeningTestStimulus ...@@ -148,13 +179,30 @@ classdef itaListeningTestStimulus
result = this.HeadphoneEquilizationFile; result = this.HeadphoneEquilizationFile;
end end
function this = set.HeadphoneEquilizationFile(this,value) function this = set.HeadphoneEquilizationFile(this,value)
this.HeadphoneEquilizationFile = value;
if isa(value,'itaAudio')
this.HeadphoneEquilizationFile = '';
this.mHeadphoneEquilization = value;
return
end
if ischar(value)
try
this.HeadphoneEquilizationFile = value;
this.mHeadphoneEquilization = ita_read(value);
catch e
end
return
end
error('Not a valid type');
% read the file
headphoneEquilization = ita_read(value);
% TODO: normalization
%headphoneEquilization.freqData = headphoneEquilization.freqData./max(max(abs(headphoneEquilization.freqData)));
this.mHeadphoneEquilization = headphoneEquilization;
end end
end end
end end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment