Commit 10b6bd08 authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter

removed writeDaffFile from itaHRTF (again)

parent f12e09ef
...@@ -1378,10 +1378,6 @@ classdef itaHRTF < itaAudio ...@@ -1378,10 +1378,6 @@ classdef itaHRTF < itaAudio
grid on;set(gca,'layer','top') grid on;set(gca,'layer','top')
end end
%% Jan's Functions
function writeDAFFFile(this, filePath)
% writes DAFF file to hard disc % writes DAFF file to hard disc
% %
% Input: filePath / fileName (string) % Input: filePath / fileName (string)
......
...@@ -32,7 +32,8 @@ classdef itaListeningTestStimulus ...@@ -32,7 +32,8 @@ classdef itaListeningTestStimulus
properties properties
UseHRTF = 1; UseHRTF = 1;
UseHeadphoneEquilization = 1; UseHeadphoneEquilization = 1;
UseSoundLevelVariation = 1;
%TODO UseTracker = 1;
HRTFFile; HRTFFile;
StimulusFile; StimulusFile;
...@@ -47,11 +48,12 @@ classdef itaListeningTestStimulus ...@@ -47,11 +48,12 @@ classdef itaListeningTestStimulus
mHRTF; mHRTF;
mHeadphoneEquilization; mHeadphoneEquilization;
mStimulus; mStimulus;
hrtfmerge;
end end
%% methods %% methods
methods methods
function returnSignal = getStimulusForDirection(this,azimuth, elevation) function returnSignal = getStimulusForDirection(this,azimuth, elevation, soundLevel)
returnSignal = this.mStimulus; returnSignal = this.mStimulus;
...@@ -60,13 +62,18 @@ classdef itaListeningTestStimulus ...@@ -60,13 +62,18 @@ classdef itaListeningTestStimulus
returnSignal = this.convoleSignals(returnSignal,HRTF); returnSignal = this.convoleSignals(returnSignal,HRTF);
end end
if (this.UseHeadphoneEquilization) if (this.UseHeadphoneEquilization == 1)
returnSignal = this.convoleSignals(returnSignal,this.mHeadphoneEquilization); returnSignal = this.convoleSignals(returnSignal,this.mHeadphoneEquilization);
end end
% TODO: Better normalization
%returnSignal = returnSignal./256;
if (this.UseSoundLevelVariation == 1)
returnSignal = returnSignal./soundLevel;
end
% TODO: Better normalization
% returnSignal = returnSignal./64;
end end
end end
...@@ -81,18 +88,16 @@ classdef itaListeningTestStimulus ...@@ -81,18 +88,16 @@ classdef itaListeningTestStimulus
end end
function HRTF = getHRTFForDirection(this,azimuth,elevation) function HRTF = getHRTFForDirection(this,azimuth,elevation)
% hrtf = this.hrtfmerge;
% this.mHRTF % coords = hrtf.channelCoordinates;
% targetCoord = itaCoordinates(1); % targetCoord = itaCoordinates(1);
% targetCoord.phi_deg = azimuth; % targetCoord.phi_deg = azimuth;
% targetCoord.theta_deg = elevation; % targetCoord.theta_deg = elevation;
% targetCoord.r = 1; % targetCoord.r = 1;
if isa(hrtf,'itaHRTF') % index = coords.findnearest(targetCoord);
HRTF = hrtf.findnearestHRTF(targetCoord); % HRTF = this.mHRTF(ceil(index/2));
else hrtf = this.hrtfmerge.findnearestHRTF(elevation,azimuth);
index = coords.findnearest(targetCoord); HRTF = hrtf.itaHRTF2itaAudio;
HRTF = this.mHRTF(ceil(index/2));
end
end end
end end
...@@ -113,32 +118,29 @@ classdef itaListeningTestStimulus ...@@ -113,32 +118,29 @@ classdef itaListeningTestStimulus
% load the HRTF data % load the HRTF data
HRTF = ita_read(value); HRTF = ita_read(value);
mergeHRTF = merge(HRTF); % TODO: normalization
maxValue = max(max(abs(mergeHRTF.freqData))); % mergeHRTF = merge(HRTF);
for index = 1:length(HRTF) % maxValue = max(max(abs(mergeHRTF.freqData)));
HRTF(index).freqData = HRTF(index).freqData./maxValue; % for index = 1:length(HRTF)
% HRTF(index).signalType = 'energy'; % HRTF(index).freqData = HRTF(index).freqData./maxValue;
end % % HRTF(index).signalType = 'energy';
% end
this.mHRTF = HRTF; this.mHRTF = HRTF;
this.hrtfmerge = itaHRTF(this.mHRTF); this.hrtfmerge = itaHRTF(merge(this.mHRTF));
end end
function result = get.StimulusFile(this) function result = get.StimulusFile(this)
result = this.StimulusFile; result = this.StimulusFile;
end end
function this = set.StimulusFile(this,value) function this = set.StimulusFile(this,value)
if ~(isa(value,'itaAudio')) this.StimulusFile = value;
this.StimulusFile = value; % read the simulus file
this.mStimulus = ita_read(value);
% read the simulus file
this.mStimulus = ita_read(value);
else
this.mStimulus = value;
end
% normalize % normalize
this.mStimulus.timeData = this.mStimulus.timeData./max(abs(this.mStimulus.timeData)); % this.mStimulus.timeData = this.mStimulus.timeData./max(abs(this.mStimulus.timeData));
end end
...@@ -150,7 +152,8 @@ classdef itaListeningTestStimulus ...@@ -150,7 +152,8 @@ classdef itaListeningTestStimulus
% read the file % read the file
headphoneEquilization = ita_read(value); headphoneEquilization = ita_read(value);
headphoneEquilization.freqData = headphoneEquilization.freqData./max(max(abs(headphoneEquilization.freqData))); % TODO: normalization
%headphoneEquilization.freqData = headphoneEquilization.freqData./max(max(abs(headphoneEquilization.freqData)));
this.mHeadphoneEquilization = headphoneEquilization; this.mHeadphoneEquilization = headphoneEquilization;
end end
end end
......
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