diff --git a/applications/Binaural-HRTF/HRTF_class/@itaHRTF/itaHRTF.m b/applications/Binaural-HRTF/HRTF_class/@itaHRTF/itaHRTF.m index 5aec57b02f9dc700b1f901265c2cf2bd29780327..7aff59ce5258ee3cfc22a8dfb0486e3ac462bfac 100644 --- a/applications/Binaural-HRTF/HRTF_class/@itaHRTF/itaHRTF.m +++ b/applications/Binaural-HRTF/HRTF_class/@itaHRTF/itaHRTF.m @@ -714,7 +714,7 @@ classdef itaHRTF < itaAudio earCoords = this.getEar('L').channelCoordinates; switch dirID case {'phi_deg', 'p'} - phiValues = unique(earCoords.phi_deg); + phiValues = uniquetol(earCoords.phi_deg); [~,index] = min(abs(phiValues - dir_deg)); exactPhiValue = phiValues(index); tmp = earCoords.n(earCoords.phi_deg == exactPhiValue); @@ -722,7 +722,7 @@ classdef itaHRTF < itaAudio slice = this.findnearestHRTF(thetaU,dir_deg); case {'theta_deg', 't'} - thetaValues = unique(earCoords.theta_deg); + thetaValues = uniquetol(earCoords.theta_deg); [~,index] = min(abs(thetaValues - dir_deg)); exactThetaValue = thetaValues(index); tmp = earCoords.n(earCoords.theta_deg == exactThetaValue); @@ -731,12 +731,12 @@ classdef itaHRTF < itaAudio slice = this.findnearestHRTF(dir_deg,phiU); end end - switch dirID - case {'phi_deg', 'p'} - slice = this.findnearestHRTF(thetaU,dir_deg); - case {'theta_deg', 't'} - slice = this.findnearestHRTF(dir_deg,phiU); - end +% switch dirID +% case {'phi_deg', 'p'} +% slice = this.findnearestHRTF(thetaU,dir_deg); +% case {'theta_deg', 't'} +% slice = this.findnearestHRTF(dir_deg,phiU); +% end end function slice = ss(this,dirID,dir_deg) @@ -915,10 +915,12 @@ classdef itaHRTF < itaAudio ITD = phasenDiff./(2*pi*repmat(thisC.freqVector,1,size(phase1,2))); else % averaged - phase = unwrap(angle(thisC.freqData)); - t0_freq = bsxfun(@rdivide, phase,2*pi*thisC.freqVector); + usedBins = thisC.freq2index(sArgs.filter(1)):thisC.freq2index(sArgs.filter(2)); + 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_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'); end case 'xcorr'