Commit 36feb18d authored by Michael Kohnen's avatar Michael Kohnen

Bug fixes and compensation of distances losses in reproduction methods

parent 1cc4de52
......@@ -6,6 +6,7 @@ function [ binOut ] = ita_binauralMixdown( lsSignals, varargin )
opts.HRTF = 'D:\DATA\sciebo\MKOScripts\HRTFs\2015_ITA-Kunstkopf_HRIR_2ch_D186_1x1_256_v17.daff'; % Path to the used HRTF
opts.LSPos = itaCoordinates; % itaCoordinates of the loudspeaker positions
opts.distanceLoss=true;
if nargin>1
opts=ita_parse_arguments(opts,varargin);
......@@ -27,11 +28,14 @@ binOut=itaAudio;
for k=1:lsSignals.nChannels
hrtf=hrtfSet.findnearestHRTF(opts.LSPos.n(k));
if opts.distanceLoss
hrtf=hrtf/LSPos.r(k);
end
convolved=ita_convolve(lsSignals.ch(k),hrtf);
if k==1
binOut=convolved;
else
binOut=binOut+convolved
binOut=binOut+convolved;
end
end
......@@ -11,7 +11,9 @@ function [ CTC ] = ita_ctcFilter_regularized( varargin )
% ch(4) = LS2 Right Ear
% ch(5) = LS3 Left Ear
% ...
%
% Make sure that the HRTFs compensate for irregular loudspeaker arrays or
% off-centered listeners.
%
% The calculation algorithm is a simple inversion. Pre- and
% Postprocessing options can be found below
%
......
function [ OutputSignals ] = ita_3da_decodeAmbisonics( Bformat, LoudspeakerPos, varargin )
function [ OutputSignals ] = ita_3da_decode( Bformat, LoudspeakerPos, varargin )
%ITA_DECODEAMBISONICS Decodes a BFormat Signal in ANC with SN3D
%normalization
% Detailed explanation goes here
......
function [ audioOut ] = ita_hoa_encodeAmbisonics( audioIn, order, sourcePos )
function [ audioOut ] = ita_hoa_encode( audioIn, order, sourcePos, varargin )
%ITA_ENCODEAMBISONICS Encodes a itaAudio with channel coordinates or a
% itaCoordinate with source positions into ambisonics channels
%
% Detailed explanation goes here
%% Init
opts.distanceloss=true;
opts=ita_parse_arguments(opts,varargin);
if isa(audioIn, 'itaAudio')
aud=true;
elseif isa(audioIn, 'itaCoordinates')
......@@ -49,4 +52,7 @@ if aud
audioOut=audioOut+ita_merge(audioOut_temp);
end
end
end
if opts.distanceLoss
audioOut=audioOut/sourcePos.r;
end
\ No newline at end of file
function weights = ita_3da_panVBAP(pos_LS,pos_VS)
function weights = ita_3da_panVBAP(pos_LS,pos_VS,varargin)
%panVBAP - Calculate weights for VBAP
%
% This function receives the position of the loudspeakers and the position
% of the virtual source. Both input must be given as objects of the class
% itaCoordinates.
% itaCoordinates.
%
% The output is the set of frequency independent weights used to pan the
% virtual source on the given array.
......@@ -20,9 +20,14 @@ function weights = ita_3da_panVBAP(pos_LS,pos_VS)
% if pos_LS.isPlane
% Number_of_active_loudspeakers = 2; %Extended Stereo
% else
Number_of_active_loudspeakers = 3;
Number_of_active_loudspeakers = 3;
% end
opts.dim=3; % Zwei oder Dreidimensionales panning, standard ist 3
opts.distanceloss = true;
opts.normalizationGain=1;
opts=ita_parse_arguments(opts,varargin);
% Init
weights = zeros(pos_VS.nPoints,pos_LS.nPoints);
if pos_VS.r == 0
......@@ -33,12 +38,12 @@ end
% Calculate the distance of each loudspeaker to the virtual source with the
% help of the itaCoordinate overloaded function itaCoordinate.r.
% To sort the distance in ascending value, use the function sort.
aux = pos_LS - pos_VS;
dist = aux.r;
[junk,index] = sort(dist,'ascend');
index = index(1:Number_of_active_loudspeakers);
active_loudspeakers = pos_LS.n(index);
aux = pos_LS - pos_VS;
dist = aux.r;
[junk,index] = sort(dist,'ascend');
index = index(1:Number_of_active_loudspeakers);
active_loudspeakers = pos_LS.n(index);
%% Calculate the weights for the active loudspeakers
% Create a base matrix with the direction of the active loudspeakers and
......@@ -53,4 +58,4 @@ for idx = 1:pos_VS.nPoints
g = abs(g)/norm(g);
weights(idx,index) = g;
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