sfstoolbox / sfs-matlab

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

Add automatic scaling to loudspeaker weights for plotting #78

Closed hagenw closed 8 years ago

hagenw commented 8 years ago

With 7b46fff0839585b595f88a95ffc84e5fb3c2f9b8 we introduced a new weighting to the loudspeakers, which results in relatively low values (<<1) for standard setups. This is of course not a problem, but has a small effect on the plotting of real loudspeaker symbols as those are colored accordingly to the absolute weight of the loudspeaker.

Here is an example from the current master:

conf = SFS_config;
conf.plot.normalisation = 'center';
conf.plot.realloudspeakers = 1;
sound_field_mono_wfs([-2 2],[-2 2],0,[0 2.5 0],'ps',800,conf)

ls_w_old

As you can see more or less all loudspeakers are white.

In this pull request I added an automatic scaling of the loudspeakers (that the maximum weight to 1) to the draw_loudspeaker function, which results in this plot by executing the same commands as above.

ls_w_new

I'm not sure yet if this is the best solution for more complex cases, but I think it is better than before.

fietew commented 8 years ago

I think its a good idea. In the context of WFS and the secondary source selection its also nice, as the active secondary source would be dark/black and the inactive are white.

Maybe it's a good idea to use the maximum of the absolute value instead of the maximum. I don't know, why there should be any negative loudspeakers weights at the moment. Maybe someone decides to implement some ambisonics panning functions in the future, which may have negative weights.

hagenw commented 8 years ago

OK, I changed it and will merge it into the master.