Commit 0f11afd4 authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter

changes to itd: ignore phase at dc

parent de092f03
...@@ -714,7 +714,7 @@ classdef itaHRTF < itaAudio ...@@ -714,7 +714,7 @@ classdef itaHRTF < itaAudio
earCoords = this.getEar('L').channelCoordinates; earCoords = this.getEar('L').channelCoordinates;
switch dirID switch dirID
case {'phi_deg', 'p'} case {'phi_deg', 'p'}
phiValues = unique(earCoords.phi_deg); phiValues = uniquetol(earCoords.phi_deg);
[~,index] = min(abs(phiValues - dir_deg)); [~,index] = min(abs(phiValues - dir_deg));
exactPhiValue = phiValues(index); exactPhiValue = phiValues(index);
tmp = earCoords.n(earCoords.phi_deg == exactPhiValue); tmp = earCoords.n(earCoords.phi_deg == exactPhiValue);
...@@ -722,7 +722,7 @@ classdef itaHRTF < itaAudio ...@@ -722,7 +722,7 @@ classdef itaHRTF < itaAudio
slice = this.findnearestHRTF(thetaU,dir_deg); slice = this.findnearestHRTF(thetaU,dir_deg);
case {'theta_deg', 't'} case {'theta_deg', 't'}
thetaValues = unique(earCoords.theta_deg); thetaValues = uniquetol(earCoords.theta_deg);
[~,index] = min(abs(thetaValues - dir_deg)); [~,index] = min(abs(thetaValues - dir_deg));
exactThetaValue = thetaValues(index); exactThetaValue = thetaValues(index);
tmp = earCoords.n(earCoords.theta_deg == exactThetaValue); tmp = earCoords.n(earCoords.theta_deg == exactThetaValue);
...@@ -731,12 +731,12 @@ classdef itaHRTF < itaAudio ...@@ -731,12 +731,12 @@ classdef itaHRTF < itaAudio
slice = this.findnearestHRTF(dir_deg,phiU); slice = this.findnearestHRTF(dir_deg,phiU);
end end
end end
switch dirID % switch dirID
case {'phi_deg', 'p'} % case {'phi_deg', 'p'}
slice = this.findnearestHRTF(thetaU,dir_deg); % slice = this.findnearestHRTF(thetaU,dir_deg);
case {'theta_deg', 't'} % case {'theta_deg', 't'}
slice = this.findnearestHRTF(dir_deg,phiU); % slice = this.findnearestHRTF(dir_deg,phiU);
end % end
end end
function slice = ss(this,dirID,dir_deg) function slice = ss(this,dirID,dir_deg)
...@@ -915,10 +915,12 @@ classdef itaHRTF < itaAudio ...@@ -915,10 +915,12 @@ classdef itaHRTF < itaAudio
ITD = phasenDiff./(2*pi*repmat(thisC.freqVector,1,size(phase1,2))); ITD = phasenDiff./(2*pi*repmat(thisC.freqVector,1,size(phase1,2)));
else % averaged else % averaged
phase = unwrap(angle(thisC.freqData)); usedBins = thisC.freq2index(sArgs.filter(1)):thisC.freq2index(sArgs.filter(2));
t0_freq = bsxfun(@rdivide, phase,2*pi*thisC.freqVector); phase = unwrap(angle(thisC.freqData(2:end,:)));
freqVector = thisC.freqVector;
t0_freq = bsxfun(@rdivide, phase,2*pi*freqVector(2:end));
t0_freq = t0_freq(~isnan(t0_freq(:,1)),:); t0_freq = t0_freq(~isnan(t0_freq(:,1)),:);
t0_mean = mean(t0_freq(unique(thisC.freq2index(sArgs.filter(1)):thisC.freq2index(sArgs.filter(2))),:)); %mean is smoother than max; lower freq smooths also the result t0_mean = mean(t0_freq(usedBins,:)); %mean is smoother than max; lower freq smooths also the result
ITD = t0_mean(thisC.EarSide == 'L') - t0_mean(thisC.EarSide == 'R'); ITD = t0_mean(thisC.EarSide == 'L') - t0_mean(thisC.EarSide == 'R');
end end
case 'xcorr' case 'xcorr'
......
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