Commit cf6a71e4 authored by Michael Kohnen's avatar Michael Kohnen

Enhanced VBAP and integrated acoustical measurements für VRLab

parent 0b358509
......@@ -11,28 +11,49 @@ opts.virtualSpeaker = false; % true || Indicates whether to
opts.coordSystem = 'itaCoordinates'; % 'openGL' || indicates in which coordinate system the output is
opts.isItaCoordinates = true; % true || indicates whether the output is a itaCoordinate or not (warning: if combined with coordSystem='opneGL', the angles for azimuth and elevation are not correct
opts.heightCorrection = 0; % in meter || ensures that the loudspeakers are around the point (0 0 0), standard value is height of the bigger loudspeaker in the horizontal plane
opts.configuration = 'acoustic'; % real || specifies wheter optical measured values are given back ('real'), 'ideal' is theoretical targeted positions, 'acoustic' measured data
opts=ita_parse_arguments(opts, varargin);
% X Y Z (openGL)
pos = itaCoordinates(zeros(12,3));
if(strcmpi(opts.configuration,'real'))
pos.r = [ 2.28 2.29 2.27 2.28 2.29 2.27 2.28 2.28 2.28 2.28 2.28 2.28 ];
pos.phi_deg = [ 45.32 313.76 225.55 134.56 0 270 180 90 0 270 180 90 ];
pos.theta_deg = [ 90 90 90 90 60.27 59.92 60.11 60.36 119.64 119.63 119.75 119.92 ];
elseif(strcmpi(opts.configuration,'ideal'))
pos.r = repmat(2.28,1,12);
pos.phi_deg = [ 45:90:360 repmat(0:90:270,1,2) ];
pos.theta_deg = [ ones(1,4)*90 ones(1,4)*60 ones(1,4)*120 ];
elseif(strcmpi(opts.configuration,'acoustic'))
pos.r = [ 2.2882 2.3118 2.3190 2.3190 2.2955 2.3063 2.3262 2.3063 2.2647 2.2792 2.3045 2.2792 ];
pos.phi_deg = [ 45.3200 313.7600 225.5500 134.5600 0 270.0000 180.0000 90.0000 0 270.0000 180.0000 90.0000 ];
pos.theta_deg = [ 90.0000 90.0000 90.0000 90.0000 60.2700 59.9200 60.1100 60.3600 119.6400 119.6300 119.7500 119.9200 ];
end
if opts.virtualSpeaker
pos.cart = [pos.cart;...
0 0 -2.3;... % virtual speaker
0 0 2.3]; % virtual speaker
0 0 -2.28;... % virtual speaker
0 0 2.28]; % virtual speaker
end
% Correction of head height
pos.z=pos.z-opts.heightCorrection;
if strcmpi(opts.coordSystem,'opengl')
pos.cart = ita_matlab2openGL(pos);
if opts.isItaCoordinates
warning('itaCoordinates are not made for openGL coordinates! Angles etc. do refer to the mathmatical representation (x-axis to the front). Use ''isItaCoordinates'', ''false''');
end
end
if (~opts.isItaCoordinates)
pos = pos.cart;
end
\ No newline at end of file
end
......@@ -13,18 +13,13 @@ function weights = ita_vbap_pan(pos_LS,pos_VS,varargin)
% Author: Michael Kohnen -- Email: mko@akustik.rwth-aachen.de
% Former author: Bruno Masiero -- Email: bma@akustik.rwth-aachen.de
% Created: 13-Jun-2011
% Last modified: 04-May-2017
% Last modified: 10-july-2019
%$ENDHELP$
%% Preliminary tests
% if pos_LS.isPlane
% Number_of_active_loudspeakers = 2; %Extended Stereo
% else
Number_of_active_loudspeakers = 3;
% end
opts.dim=3; % Zwei oder Dreidimensionales panning, standard ist 3
opts.distanceloss = true;
opts.normalizationGain=1/3;
opts.normalizationGain=1;
opts.minimumDistance=0.25;
opts=ita_parse_arguments(opts,varargin);
% Init
......@@ -34,6 +29,14 @@ if pos_VS.r == 0
error('No direction for Virtual Source was given!')
end
pos_VS.r( pos_VS.r<opts.minimumDistance ) = opts.minimumDistance;
origDistances = pos_VS.r;
pos_VS.r=mean(pos_LS.r);
%% Find the closest loudspeakers
% Calculate the distance of each loudspeaker to the virtual source with the
% help of the itaCoordinate overloaded function itaCoordinate.r.
......@@ -41,7 +44,7 @@ end
aux = pos_LS - pos_VS;
dist = aux.r;
[junk,index] = sort(dist,'ascend');
index = index(1:Number_of_active_loudspeakers);
index = index(1:3);
active_loudspeakers = pos_LS.n(index);
......@@ -56,6 +59,6 @@ for idx = 1:pos_VS.nPoints
g = p*pinv(L);
% Re-normalize
g = abs(g)/norm(g);
weights(idx,index) = (g./pos_VS.r(idx).*pos_LS.r(index)').*1/3;
weights(idx,index) = (g./origDistances(idx).*pos_LS.r(index)');
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment