diff --git a/get_distance.m b/get_distance.m
new file mode 100644
index 0000000000000000000000000000000000000000..d45fc052f60cbd231f148e1fe9be0c2ad023d03a
--- /dev/null
+++ b/get_distance.m
@@ -0,0 +1,100 @@
+function [d_close, ic_mean] = get_distance(signal, thr)
+% function to get the estimated distance from a binaural measurement with
+% using the interaural coherence
+
+%This fcn is based on the DEMO_IC.m from the Two!Ears project
+
+
+%% init
+fs = 24414;
+
+%% LOAD SIGNAL
+%
+
+
+% Create a data object based on the ear signals
+dObj1 = dataObject(signal,fs);
+
+% % Load erverberant signal
+% load('Test_signals/DEMO_Speech_Room_D');
+%
+% % Create a data object based on the ear signals
+% dObj2 = dataObject(earSignals(1:22494,:),fsHz);
+
+
+%% PLACE REQUEST AND CONTROL PARAMETERS
+%
+%
+% Request interaural coherence (IC)
+requests = {'ic'};
+
+% Parameters of the auditory filterbank processor
+fb_type       = 'gammatone';
+fb_lowFreqHz  = 300;
+fb_highFreqHz = 2000;
+fb_nChannels  = 8;
+
+% Parameters of innerhaircell processor
+ihc_method    = 'dau';
+
+% Parameters of crosscorrelation processor
+cc_wSizeSec  = 0.5;
+cc_hSizeSec  = 0.2;
+cc_wname     = 'hann';
+
+% Summary of parameters
+par = genParStruct('fb_type',fb_type,'fb_lowFreqHz',fb_lowFreqHz,...
+    'fb_highFreqHz',fb_highFreqHz,'fb_nChannels',fb_nChannels,...
+    'ihc_method',ihc_method,'cc_wSizeSec',cc_wSizeSec,...
+    'cc_hSizeSec',cc_hSizeSec,'cc_wname',cc_wname);
+
+
+%% PERFORM PROCESSING
+%
+%
+% Create two managers
+mObj1 = manager(dObj1,requests,par);
+%mObj2 = manager(dObj2,requests,par);
+
+% Request processing
+mObj1.processSignal();
+%mObj2.processSignal();
+
+
+%% PLOT RESULTS
+%
+%
+
+plot = 0;
+
+if plot
+    % Plot the original ear signal
+    dObj1.plot([],[],'bGray',1,'decimateRatio',3,'bSignal',1);
+    ylim([-1.25 1.25]);
+    
+    % Plot IC
+    dObj1.ic{1}.plot;
+    title('Interaural coherence (anechoic)')
+    
+    % Plot the original ear signal
+%     dObj2.plot([],[],'bGray',1,'decimateRatio',3,'bSignal',1);
+%     ylim([-1.25 1.25]);
+    
+%     % Plot IC
+%     dObj2.ic{1}.plot;
+%     title('Interaural coherence (reverberant)')
+end
+
+%% Distance guesstimation
+ic_Obj = dObj1.ic;
+ic_Obj = ic_Obj{1}.Data;
+ic = ic_Obj(:);
+
+ic_mean = mean(mean(ic));
+
+if ic_mean >= thr
+    d_close = 1;
+else
+    d_close = 0; 
+end
+