Skip to content

Commit

Permalink
Adjusted parallax shift in supdeq_deq for arbitrary ear positions
Browse files Browse the repository at this point in the history
  • Loading branch information
AudioGroupCologne committed Sep 21, 2019
1 parent f1c4f09 commit ba38f65
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions supdeq_deq.m
Expand Up @@ -151,15 +151,25 @@
fprintf('Considering acoustic parallax...\n');

%Factor acoustic parallax effect into dense sampling grid
%(1) - Transform sampling grid to radiant in matlab coordinates system
%(1) - Transform sampling grid and ear positions to radiant in matlab coordinates system
samplingGridRad(:,1:2) = samplingGrid(:,1:2)*pi/180;
samplingGridRad(:,2) = pi/2 - samplingGridRad(:,2);
%(2) - Transform to cartesian coordinates and apply parallax shift
[x,y,z] = sph2cart(samplingGridRad(:,1),samplingGridRad(:,2),deqDataset.sourceDistance);
yL=y-deqDataset.radius;
yR=y+deqDataset.radius;
[AzParL,ElParL] = cart2sph(x,yL,z);
[AzParR,ElParR] = cart2sph(x,yR,z);
earPosition_L = deqDataset.earPosition(1:2)*pi/180;
earPosition_L(2) = pi/2 - earPosition_L(2);
earPosition_R = deqDataset.earPosition(3:4)*pi/180;
earPosition_R(2) = pi/2 - earPosition_R(2);
%(2) - Transform sampling grid and ear positions to cartesian coordinates and apply parallax shift
[x,y,z] = sph2cart(samplingGridRad(:,1),samplingGridRad(:,2),deqDataset.sourceDistance);
[x_ear_L,y_ear_L,z_ear_L] = sph2cart(earPosition_L(:,1),earPosition_L(:,2),deqDataset.radius);
[x_ear_R,y_ear_R,z_ear_R] = sph2cart(earPosition_R(:,1),earPosition_R(:,2),deqDataset.radius);
xL = x-x_ear_L;
xR = x-x_ear_R;
yL = y-y_ear_L;
yR = y-y_ear_R;
zL = z-z_ear_L;
zR = z-z_ear_R;
[AzParL,ElParL] = cart2sph(xL,yL,zL);
[AzParR,ElParR] = cart2sph(xR,yR,zR);
%(3) - Transform back to degree in SH coordinates system
AzParL = mod(AzParL,2*pi);
AzParR = mod(AzParR,2*pi);
Expand Down
2 changes: 1 addition & 1 deletion supdeq_getEqDataset.m
Expand Up @@ -17,7 +17,7 @@
% Input:
% N - Transform order N
% Default: 35
% earDistance - Distance between both ear positions in m (radius/2)
% earDistance - Distance between both ear positions in m (radius*2)
% Default: 0.165
% NFFT - FFT size of the SH-coefficients to be returned
% Default: 512
Expand Down

0 comments on commit ba38f65

Please sign in to comment.