Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Martin Karlsson
turtlerob1
Commits
1f081f48
Commit
1f081f48
authored
Sep 25, 2015
by
Axel Ahrens
Browse files
added the distance estimator
parent
25e9db98
Changes
1
Hide whitespace changes
Inline
Side-by-side
get_distance.m
0 → 100644
View file @
1f081f48
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment