[ file av16.3_v6/EXAMPLES/AUDIO/README ]

This MATLAB example was provided by Guillaume Lathoud ( lathoud@idiap.ch ).

It implements a grid-based, single source localization method
based on the parametric method called SRP-PHAT.
More details about SRP-PHAT can be found in the following reference:

DiBiase, J., Silverman, H., Brandstein, M.:
Robust Localization in Reverberant Rooms.
Microphone Arrays, Eds. Brandstein, M., Ward, D., Springer (2001), 157-180.


Below are MATLAB lines implementing the example,
as well as comparison with the ground-truth.

Guillaume Lathoud - lathoud@idiap.ch


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2004-08-25
% Demonstration of:
% - simple grid-based SRP-PHAT single source localization.
% - use of the AV16.3 ground-truth speaker mouth location.

dbstop error
clear all

addpath ../..
o = seq_av163( 'seq01-1p-0000', '../..' );

channels = 1:8;
nchannels = length( channels );

in_p = [];
in_p.geometry = o.MA_GEOMETRY( :, channels );
in_p.geometry = in_p.geometry - repmat( mean( in_p.geometry, 2 ), 1, nchannels );
in_p.wavfile_list = o.MA_FILE_LIST( channels );
in_p.pairs = nchoosek( 1:nchannels, 2 );
in_p.c = 342;  % speed of sound in the air, in m/s
in_p.starttime_sec = 0;
in_p.endtime_sec = +Inf;   % Process everything

in_p.gridfilename = '';

dbstop error
[xyzs,p] = srpphatloc( in_p );

[az,el,r] = cart2sph(xyzs(1,:),xyzs(2,:),xyzs(3,:));

f = p.firstframe:p.lastframe;
t = p.framelength_sec / 2 + (f-1) * p.frameshift_sec;
figure; plot( t, az/pi*180, '.' );


% Now that we have a result, we can compare with the ground-truth

load( o.GT_FILE, 'static_gt' );

in_q = [];
in_q.framelist       = [ p.firstframe p.lastframe ];
in_q.framelength_sec = p.framelength_sec;
in_q.frameshift_sec  = p.frameshift_sec;

array_ind = 1;  % Channels 1 to 8

angle_gt = static_gt_2_angle_gt( in_q, static_gt, array_ind );

hold on; plot( t, angle_gt.az_mat( 1,: ) / pi * 180, 'ro' );
legend( 'result', 'ground-truth' );
xlabel( 'time (seconds)' )
ylabel( 'azimuth (degrees)' )
axis tight; v = axis; axis( [ v(1:2) -180 180 ] );


delta = -pi + mod( az - angle_gt.az_mat( 1,: ) + pi, 2 * pi );
delta = delta( find( ~isnan( delta ) ) );


figure; hist( delta / pi * 180, 100 );
xlabel( 'azimuth error in degrees' );
ylabel( 'number of frames' );


tolerance_list = [ 0.05 1:180 180.01 ] / 180 * pi;
proportion_list = [];
for a_tol = tolerance_list
  proportion_list( end+1 ) = mean( abs( delta ) <= a_tol );
end
figure; plot( tolerance_list/pi*180, 100*proportion_list );
axis( [ 0 180 0 100 ] );  xlabel( 'azimuth error in degrees' ); ylabel( '% of frames below error' );
