sfstoolbox / sfs-matlab

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

Time-Domain Implementation of LocalWFS using Spatial Bandwidth-Limitation #135

Closed fietew closed 7 years ago

fietew commented 7 years ago

Yet another method for Local Sound Field Synthesis. Here, the plane wave decomposition of a modally truncated sound field is reproduced via conventional Wave Field Synthesis. Due to the modal truncation, like in NFCHOA, spatial aliasing is avoided.

TODOs:

hagenw commented 7 years ago

I had a first look at it and corrected formal stuff. Those points are still pending and it would be nice if you could have a look at them:

hagenw commented 7 years ago

By running test_imp_25d() I got the following error:

error: DRIVING_FUNCTION_IMP_LOCALWFS_SBL: conf.t0 (system) other than "source" is not supported
error: called from
    driving_function_imp_localwfs_sbl at line 67 column 5
    test_imp_25d at line 117 column 11

I added conf.t0 = 'source'; to avoid this.

hagenw commented 7 years ago

In test_imp_25d(), if I change conf.delayline.resampling = 'pm'; to conf.delayline.resampling = 'matlab'; I'm getting completely different results. Is this the same for you? The results with pm look a lot better.

hagenw commented 7 years ago

test_imp_25d() is still not running to the end for me and I get

error: 'linkwitz_riley' undefined near line 102 column 20
error: called from
    circexp_imp_ps at line 102 column 18
    driving_function_imp_localwfs_sbl_ps at line 76 column 19
    driving_function_imp_localwfs_sbl at line 73 column 21
    test_imp_25d at line 118 column 11

Is linkwitz_riley() part of Matlab or do you have forgotten to add it?

hagenw commented 7 years ago

Thanks, now I'm getting the following error with test_imp_25d(1):

error: bilinear: must have at least as many poles as zeros in s-plane
error: called from
    bilinear at line 91 column 5
    circexp_imp_ps at line 114 column 15
    driving_function_imp_localwfs_sbl_ps at line 76 column 19
    driving_function_imp_localwfs_sbl at line 73 column 21
    test_imp_25d at line 118 column 11
fietew commented 7 years ago

I can't reproduce this error under MATLAB. Is it octave related?

hagenw commented 7 years ago

Yes, I remember. Could you have a look at bilinear_transform() and use that one instead. There it is internally managed to distinguish between Matlab and Octave as the needed function call to bilinear() is different.

fietew commented 7 years ago

This straightforward, as bilinear_transform() does required second order sections and does not return zero-pole-gain representations. I will try to handle the octave stuff directly.

fietew commented 7 years ago

The error occurs, for n=0 inside the loop of circexp_imp_ps. It seems that octave does not handle the case, where there is no zero and no pole, correctly.

fietew commented 7 years ago

@hagenw: I'm still getting an error under octave which is related to my (maybe broken) octave installation. Could you give it a try?

hagenw commented 7 years ago

The problem with calling bilinear() seems to be fixed now, but I'm getting a new error:

error: Invalid call to sosfilt.  Correct usage is:

 -- Loadable Function: Y = sosfilt (SOS, X)
error: called from
    print_usage at line 90 column 5
    circexp_imp_ps at line 128 column 15
    driving_function_imp_localwfs_sbl_ps at line 91 column 19
    driving_function_imp_localwfs_sbl at line 77 column 21
    test_imp_25d at line 118 column 11

And one question regarding your fix: under Octave you are now simply ignoring m=0. What are the consequences? Could you ignore it also under Matlab?

fietew commented 7 years ago

No, I'am not ignoring it. For n=0, zh and ph are empty before and after the bilinear transform. If there are no zeros/poles in the s-domain, there will be no zeros/poles in the z-domain.

fietew commented 7 years ago

I fixed the call of sosfilt for octave, but the results for the point source in octave and MATLAB do not coincide.

matlab.pdf octave.pdf

fietew commented 7 years ago

butter() yields row vectors in octave instead of column vectors in MATLAB. This resulted into different driving functions. Fixed with 5b06030.

hagenw commented 7 years ago

Cool, it is working now.

hagenw commented 7 years ago

You asked if we should provide more test functions. Maybe it is a good idea to add a test function for circexp_imp/ and pwd_imp/ as those are more general and not only connected to LSFS?

chris-hld commented 7 years ago

I agree, these expansions / decompositions are very basic and therefore critical. Also it might help to have a simple example, which could then include the testing?

fietew commented 7 years ago

added new test function and resolved conflicts with master

hagenw commented 7 years ago

The new test function is working fine for me. Maybe you could add a title to every plot like we did it in test_driving_functions(). Then it will be easier to interpret the single plots.