-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New NFC-HOA line source driving function for the mono-chromatic case #54
Conversation
* master: (25 commits) Update NEWS Fix coding style Update NEWS Fix comments Add validation function for secondary source selection An odd prefilter order now raises an error in wfs_fir_prefilter. Rounding therefore no longer required in sound_field_imp_*wfs. (fixed another error message in wfs_fir_prefilter) Small coding style fix Delay Compensation of FIR prefilter for local WFS Delay compensation for FIR prefilter (IIR should be minimum phase anyway) WFS FIR filter of arbitrary even order (-> odd length) Note: Filter length is no longer a power of 2. If this is desired e.g. in convolution(), it's possibly better done there. WFS prefilter order added to config struct fix missing idx for vss fix recursive call of selection function and remove time consuming vector product Update NEWS Change Ambisonics order for even loudspeaker numbers Update NEWS Cleanup code fix problem with zero fractional delay due to implementation of sinus cardinalis Update NEWS and set version to 2.1.0 Add extra space for Windows banner ...
Great. I think the driving functions are implemented correctly. So far, there is nothing new.
Once this is resolved, I think we are good to merge. |
The 3D case is indeed interesting. A few more questions from my side, before proposing a solution:
It's always a little bit confusing when talking about virtual sources that have characteristics that are not compatible with the underlying secondary sources ;) |
YES and YES. The current driving function can be used for 3D NFC-HOA (using spherical distribution of secondary point sources), only if the line source is parallel to the z-axis. In order to specify an arbitrarily oriented line source, we need a position vector and an orientation vector. The degree of freedom is 5. Would it be OK to allow |
In principle it is possible to have In the case of 3D NFC-HOA and the line source we should ask if it would be of advantage to have the possibility to orient the line source to arbitrary directions. If you have only one line source, then it is not needed as the array is completely symmetrical and you can adjust the axis accordingly. The only case where it might be of interest is when you want to use more than one line source simultaneously and they should have different orientations (for whatever reasons). As I have not really an opinion on this, you can decide what you would prefer. |
If think, the degrees of freedom for the position + orientation of an infinitely long line source in 4. Its orientation can be defined by two angles or a unit vector (2 DOFs) and its position is given by any point being part of the line (2 DOFs). However, I think that we should stick to the nomenclature of 6 entries, i.e. orientation vector + position vector, as Hagen mentioned. |
Maybe we should just rotate the coordinate system, i.e. the position of the secondary sources and the line source, such that the line source is always aligned with the z-axis. This could be done inherently within the function, which computes the driving function. |
I think this does not hold for discrete arrays. |
At the starting point of this discussion we were talking about 3D spherical arrays only, so I guess in infinite array is not really considered here. |
I think a 3-entry Since all The question remains what to do in the 2D case if something else than |
It now works with xs of size [1x6]
I would say we use now I prepared the WFS monochromatic driving functions for this. @trettberg could you start implementing the proposed solution for WFS in driving_function_mono_wfs_ls(). Everything is prepared and the driving function is expecting a xs with 6 entries (but it is not checked for the correct size yet). For the 2D and 2.5D case I propose that we do an automatic projection and raise a warning if we had to do this. @narahahn could you implement your proposed solution for NFC-HOA? |
Yes, I will implement the NFC-HOA driving function for arbitrary line sources. |
secondary source selection still WIP
-> works with proper 2D array -> No guarantees otherwise
WFS line source should be okay now. For easier visual inspection, here's a planar array: conf = SFS_config();
%% construct a square array in the y=0.5 plane
conf.secondary_sources.geometry = 'line';
conf.secondary_sources.number = 31;
x0_line = secondary_source_positions(conf);
M = size(x0_line,1);
dx = abs(x0_line(2,1) - x0_line(1,1))
x0 = repmat(x0_line,[M,1]);
for z = 1:M
x0((z-1)*M+1:z*M,3) = (z-1)*dx;
end
x0(:,2) = 0.5;
conf.secondary_sources.x0 = x0;
conf.secondary_sources.geometry = 'custom';
conf.secondary_sources.number = 31^2;
%%
conf.dimension = '3D';
conf.usetapwin = 0;
xs = [0,2,0,0,0,1];
f = 1000;
sound_field_mono_wfs([-2,2],[-3,1],0,xs,'ls',f,conf);
sound_field_mono_wfs(0,[-3,1],[-0.5,3.5],xs,'ls',f,conf); |
- rotation matrix R computed from nxs - rotation of virtual source and secondary sources - line source aligend parallel to the z-axis
Now virtual line sources with arbitrary alignment can be synthesized using NFC-HOA.
SFS_start;
conf = SFS_config;
conf.dimension = '3D';
conf.secondary_sources.number = 169;
conf.secondary_sources.geometry = 'sphere';
conf.resolution = 100;
conf.plot.normalisation = 'center';
X = randi([-1000 1000],125000,1)/2000;
Y = randi([-1000 1000],125000,1)/2000;
Z = randi([-1000 1000],125000,1)/2000;
% vertical line source
xs = [0 1.7 0, ... % position
0 0 1]; % orientation
src = 'ls';
f = 750;
sound_field_mono_nfchoa(X,Y,Z,xs,src,f,conf);
% print('-dpng','linesource_vertical')
% horizontal line source
xs = [1.7 0 0, ... % position
0 1 0]; % orientation
src = 'ls';
f = 750;
sound_field_mono_nfchoa(X,Y,Z,xs,src,f,conf);
% print('-dpng','linesource_horizontal')
% tilted line source
xs = [-2 -2 0, ... % position
1 1 1]; % orientation
src = 'ls';
f = 750;
sound_field_mono_nfchoa(X,Y,Z,xs,src,f,conf);
% print('-dpng','linesource_tilted') |
* 'nfchoa_ls' of github.com:sfstoolbox/sfs: virtual line sources with arbitrary orientations Remove over-eager checks of requested xs fo 2D and 2.5D -> works with proper 2D array -> No guarantees otherwise Fix Secondary Source Selection for 3D Line Source fix WFS 3D Driving function line source, secondary source selection still WIP Add WFS 3D ls case to test_driving_functions() 3D WFS Line Source Driving function Update monochromatic WFS driving functions for ls
Nice! In WFS for 2D and 2.5D we restrict the orientation of the line source to be [0 0 1] for all cases. conf = SFS_config;
conf.plot.normalisation = 'center';
sound_field_mono_wfs([-2 2],[-2 2],0,[0 2.5 0 0 0 1],'ls',1000,conf); sound_field_mono_nfchoa([-2 2],[-2 2],0,[0 2.5 0 0 1 1],'ls',1000,conf); sound_field_mono_nfchoa([-2 2],[-2 2],0,[0 2.5 0 1 0 1],'ls',1000,conf); sound_field_mono_nfchoa([-2 2],[-2 2],0,[0 2.5 0 1 1 0],'ls',1000,conf); |
To be honest, I was concentrating too much on 3D cases and forgot to take |
No problem, you could do it exactly like @trettberg did for the WFS line source |
2D and 2.5D configurations ignores nxs and the z-component of xs.
2D and 2.5D NFC-HOA now use cylindrical coordinate representation of line source position |
* 'nfchoa_ls' of github.com:sfstoolbox/sfs: Fix the dimensionality mismatch in 2D and 2.5D
Perfect, now we have the same behavior for WFS and NFC-HOA.
There is only one position in the code left that is not so nice yet, see secondary_source_selection. Beside this small question everything should be fine now. |
This raises a somewhat abstruse issue for the 2D and 2.5D case: The secondary source selection uses Personally I don't think that's an issue and would leave it this way. But if this is undesirable, |
I also don't think that this is an issue. I added a NOTE to the corresponding section in the I'm going to merge this pull request now. |
New NFC-HOA line source driving function for the mono-chromatic case
Hi Nara.
This is the code I implemented after your 138th AES Convention paper: http://spatialaudio.net/virtual-cylindrical-waves/
We talked about it some time ago, but I'm not 100% sure about the current status. Could you check if it is ok and merge it into master.