Commit cb274178 authored by Axel Ahrens's avatar Axel Ahrens
Browse files

adapted get_distance to produce plots

parent a0688535
function [d_close, ic_mean] = get_distance(signal, thr) function [d_close, ic_mean] = get_distance(signal, thr, plot_)
% function to get the estimated distance from a binaural measurement with % function to get the estimated distance from a binaural measurement with
% using the interaural coherence % using the interaural coherence
...@@ -30,9 +30,9 @@ requests = {'ic'}; ...@@ -30,9 +30,9 @@ requests = {'ic'};
% Parameters of the auditory filterbank processor % Parameters of the auditory filterbank processor
fb_type = 'gammatone'; fb_type = 'gammatone';
fb_lowFreqHz = 300; fb_lowFreqHz = 100; %300
fb_highFreqHz = 2000; fb_highFreqHz = 8000; %2k
fb_nChannels = 8; fb_nChannels = 32;
% Parameters of innerhaircell processor % Parameters of innerhaircell processor
ihc_method = 'dau'; ihc_method = 'dau';
...@@ -65,16 +65,21 @@ mObj1.processSignal(); ...@@ -65,16 +65,21 @@ mObj1.processSignal();
% %
% %
plot = 0; %plot = 0;
if plot if plot_
% Plot the original ear signal % Plot the original ear signal
dObj1.plot([],[],'bGray',1,'decimateRatio',3,'bSignal',1); % dObj1.plot([],[],'bGray',1,'decimateRatio',3,'bSignal',1);
ylim([-1.25 1.25]); % ylim([-2^16/2 2^16/2]);
% Plot IC % Plot IC
dObj1.ic{1}.plot; dObj1.ic{1}.plot;
title('Interaural coherence (anechoic)') title('Interaural coherence')
lims_x = get(gca, 'Xlim');
lims_y = get(gca, 'Ylim');
rectangle('Position',[lims_x(1) 6 sum(abs(lims_x)) 19-6], 'LineWidth',4)
% Plot the original ear signal % Plot the original ear signal
% dObj2.plot([],[],'bGray',1,'decimateRatio',3,'bSignal',1); % dObj2.plot([],[],'bGray',1,'decimateRatio',3,'bSignal',1);
...@@ -90,7 +95,7 @@ ic_Obj = dObj1.ic; ...@@ -90,7 +95,7 @@ ic_Obj = dObj1.ic;
ic_Obj = ic_Obj{1}.Data; ic_Obj = ic_Obj{1}.Data;
ic = ic_Obj(:); ic = ic_Obj(:);
ic_mean = mean(mean(ic)); ic_mean = mean(mean(ic(:,6:19)));
if ic_mean >= thr if ic_mean >= thr
d_close = 1; d_close = 1;
......
...@@ -18,7 +18,7 @@ while(true) ...@@ -18,7 +18,7 @@ while(true)
end end
% The angle to the source is small enough, take a step forward % The angle to the source is small enough, take a step forward
[there, ic] = get_distance(audio, th_dist); [there, ic] = get_distance(audio, th_dist, 0);
if ~there if ~there
sendPosition.moveRelativePosition('map', step_distance, 0, 0); sendPosition.moveRelativePosition('map', step_distance, 0, 0);
...@@ -28,6 +28,7 @@ while(true) ...@@ -28,6 +28,7 @@ while(true)
% We are there, analyze the source % We are there, analyze the source
source_label = analyze_source(audio); source_label = analyze_source(audio);
[there, ic] = get_distance(audio, th_dist, 1);
display('Source label determined') display('Source label determined')
disp(source_label) disp(source_label)
......
Supports Markdown
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