sfstoolbox / sfs-matlab

SFS Toolbox for Matlab/Octave
https://sfs-matlab.readthedocs.io
MIT License
97 stars 39 forks source link

3D time-domain NFCHOA driving function #117

Closed vancymoon closed 7 years ago

vancymoon commented 7 years ago

When I try to use the ir_nfchoa function

ir = ir_nfchoa([0 0 0],0,[3 3 -3],'ps',hrtf,conf);

Errors occur:

Warning: SOFA 0.6 upgraded to 1.0 
> In SOFAupgradeConventions (line 145)
  In SOFAload (line 186)
  In getting_start (line 9) 
Error using to_be_implemented (line 55)
This functionality has to be implemented yet!

Error in driving_function_imp_nfchoa_ps (line 116)
        to_be_implemented;

Error in driving_function_imp_nfchoa (line 97)
        sos = driving_function_imp_nfchoa_ps(n-1,R,r_src,conf);

Error in ir_nfchoa (line 77)
d = driving_function_imp_nfchoa(x0,xs,src,conf);

Error in getting_start (line 12)
ir = ir_nfchoa([0 0 0],0,[3 3 -3],'ps',hrtf,conf);

How can I solve this problem?

hagenw commented 7 years ago

Hi,

as I deduce from your error message (line 116 in driving_function_imp_nfchoa_ps) you are trying to simulate 3D NFC-HOA, so I guess you set conf.dimension = '3D'.

The error occurs as we have only implemented the 2.5D variant of a point source for NFC-HOA in 2.5D in the time domain. Unfortunately, 2D and 3D are not yet implemented in the time domain, so you cannot create binaural simulations for those setups and NFC-HOA, but only for a 2.5D setup (which means using a circular loudspeaker array consisting of point sources).

@fietew: are we able to implement the 3D variant or will it be complicated?

fietew commented 7 years ago

Yes the coefficients are basically the same as for the 2.5D variant, see http://sfstoolbox.org/en/latest/#sec-driving-functions-nfchoa-sdm-point-source. We can reuse the radial filters from https://github.com/sfstoolbox/sfs-matlab/blob/master/SFS_time_domain/driving_function_imp_nfchoa.m#L90 and just change the summation + incorporating the spherical harmonics.

nettings commented 7 years ago

Here's another user who would like to use 3D NFC HOA :-D

hagenw commented 7 years ago

Good news, 3D NFC-HOA in the time domain is now implemented (in the master branch).

Which means ir_nfchoa() should now also work for 3D setups. Note, that you need a proper 3D HRTF data set in order to do it. You could use HRIR_FULL2DEG.sofa or FABIAN_HRIR_measured_HATO_0.sofa for this purpose.

All you have to do is then

conf = SFS_config;
conf.dimension = '3D';
hrirs = SOFAload('FABIAN_HRIR_measured_HATO_0.sofa');
ir = ir_nfchoa([0 0 0],0,[3 3 -3],'ps',hrirs,conf);

If you would like to use exactly the same loudspeaker setup as measured by the HRTFs, you could use

conf.secondary_sources.x0 = hrirs;

Otherwise you have to decide for a grid, which can be equally_spaced_points or gauss:

>> conf.secondary_sources.grid

ans =

equally_spaced_points
hagenw commented 7 years ago

Included in new 2.4.0 release.