sofacoustics / SOFAtoolbox

SOFA Toolbox (API for Matlab, Octave)
http://sofaconventions.org
European Union Public License 1.2
116 stars 31 forks source link

ITD calculation / HRIR low-frequency extension #27

Closed davircarvalho closed 2 years ago

davircarvalho commented 3 years ago

Interaural Time Difference (ITD):

ITD estimate for the SimpleFreeFieldHRIR conventions:

ITD visualization:

Low-frequency extension (LFE)

LFE for the SimpleFreeFieldHRIR conventions:

Demos

isfmiho commented 2 years ago

Hi, thanks for your contribution!!! Sorry that it took me so long to continue with SOFA, I plan to integrate everything during the next days:

Br, Miho

isfmiho commented 2 years ago

Hi Davi, I tried to run your demos "as they are" and it seems that your ITD demo has some issues with resampling (Win10, Matlab R2021b). Can you reproduce the errors on your machine?

>>demo_SOFAgetITD
Index in position 1 exceeds array bounds. Index must not exceed 4098.

Error in signal.internal.resample.uniformResample (line 126)
    yTmp2 = yTmp(indV,:);

Error in resample (line 198)
            signal.internal.resample.uniformResample(xIn, isDimValSet, Dim, dimIn, numericArgs{:});

Error in SOFAgetITD>resample_this (line 141)
            IR(k, l, :) = resample(X(k,l,:), p, q, lpFilt);

Error in SOFAgetITD>sofaResample (line 111)
IR = resample_this(Obj.Data.IR, Fs_sofa, Fs);

Error in SOFAgetITD (line 44)
    Obj_upsample = sofaResample(Obj, fs_up);

Error in demo_SOFAgetITD (line 20)
[itd_time, Obj_time] = SOFAgetITD(Obj, 'time', 'thr', 20);
davircarvalho commented 2 years ago

Hi Miho, thanks for the heads up, I managed to reproduce the error, the internal resample function has changed in Matlab R2021b, but I was still in R2021a that's why I didn't catch it before, but it's fixed now (it was just a simple squeeze() missing) 😄

isfmiho commented 2 years ago

Hi Davi, the migration should be done; thanks a lot for the contribution!! And thanks for fixing the resample issue so quickly. If you want you can have a look at the master branch. If you are happy we can close the pull request.

davircarvalho commented 2 years ago

I'm glad to contribute, thanks Miho!