sfstoolbox / sfs-matlab

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

Error when generating impulse responses for SSR #42

Closed bayesrule closed 8 years ago

bayesrule commented 8 years ago

Hi,

We followed the example to generate impulse responses for SSR. Commands:

conf = SFS_config_example;
SFS_start;
SOFAstart;
irs = SOFAload('QU_KEMAR_anechoic_3m.sofa');
brs = ssr_brs_wfs([0,0,0],pi/2,[0,3,0],'ps',irs,conf);
wavwrite(brs,44100,16,'brs_set_for_SSR.wav');

However, wave file looks wrong (all 720 channels)

We also experimented with ssr_brs_point_source(), which actually suits our need the most.

brs = ssr_brs_point_source([0,0,0],pi/2,[0,3,0],irs,conf);

We got very similar results.

brs_channel_1

And the correct one we got from the example impulse response in SSR is like

brir_1

Would like to hear your comments. Many thanks!

hagenw commented 8 years ago

Hi,

did you used headphone compensation? I tested it without headphone compensation and in both cases it is working for me:

Point source

SFS_start
SOFAstart
conf = SFS_config_example;
irs = SOFAload ('QU_KEMAR_anechoic_3m.sofa');
conf.ir.usehcomp = false;
brs = ssr_brs_point_source([0,0,0],pi/2,[0,3,0],irs,conf);
figure; plot(brs(:,1))
axis([0 1500 -0.35 0.35])

ps

WFS point source

SFS_start
SOFAstart
conf = SFS_config_example;
irs = SOFAload ('QU_KEMAR_anechoic_3m.sofa');
conf.ir.usehcomp = false;
brs = ssr_brs_wfs([0,0,0],pi/2,[0,3,0],irs,conf);
figure; plot(brs(:,90))
axis([0 1000 -0.15 0.15])

wfs

bayesrule commented 8 years ago

Cool! Problem solved. This suggests that we should research the conf and other stuff carefully.

Many thanks!

hagenw commented 8 years ago

Hi, yes you need to know what you are doing ;)

One thing you could do to figure out which conf entries are actual used during your call of a function is to not call conf = SFS_config_example; directly, but start with an empty struct conf = struct; and then call your function, for example brs = ssr_brs_wfs([0,0,0],pi/2,[0,3,0],'ps',irs,conf);. Then you will get an error message for every missing conf entry (via calling the function several times and setting the needed conf entries by hand). If you set the single conf entries manually it will also be easier to see for you in some month which exact configuration you did used during producing your binaural simulation. This might be a good idea as it could happen that entries in SFS_config_example could change over time.

Regarding the headphone compensation, maybe we should set its default value to false instead of true. But you have to consider, that if you want to use the binaural simulation of your setup in a listening experiment with headphones you really should apply headphone compensation.

bayesrule commented 8 years ago

Yes, indeed. starting with an empty struct is a good idea =)