Commit 6383bb57 authored by Joanna Luberadzka's avatar Joanna Luberadzka

Machine Listener - localizer scripts added; quick solution (one if loop) to...

Machine Listener - localizer scripts added; quick solution (one if loop) to solve the problem with def.exppar1 (which was sometimes a vector and sometimes a cell
parent 52bad89d
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
% Copyright (c) 1999-2013 Stephan Ewert. % Copyright (c) 1999-2013 Stephan Ewert.
% directory with hrir data base: % directory with hrir data base:
def.hrirdir='/media/joanna/daten/user/joanna/Data/HRIR_HendrikKayser/' def.hrirdir='/media/joanna/daten/user/joanna/Data/HRIR_HendrikKayser/';
% directory with ollo data base: % directory with ollo data base:
def.ollodir='/media/joanna/daten/user/joanna/Data/my_OLLO/OLLO_data/OLLO2.0_NO/' def.ollodir='/media/joanna/daten/user/joanna/Data/my_OLLO/OLLO_data/OLLO2.0_NO/';
% general measurement procedure % general measurement procedure
def.measurementProcedure = 'transformedUpDown'; % measurement procedure def.measurementProcedure = 'transformedUpDown'; % measurement procedure
......
...@@ -76,7 +76,8 @@ addpath(genpath(def.hrirdir)) ...@@ -76,7 +76,8 @@ addpath(genpath(def.hrirdir))
% create a cell array which has the same lenght as % create a cell array which has the same lenght as
% the number of referece angles that we want to test % the number of referece angles that we want to test
setup.HRIRs=cell(length(def.exppar1),1) % [0 45 90]; if iscell(def.exppar1);def.exppar1=cell2mat(def.exppar1);end
setup.HRIRs=cell(length(def.exppar1),1); % [0 45 90];
for k=1:length(setup.HRIRs) for k=1:length(setup.HRIRs)
%load the hrir for the reference angle %load the hrir for the reference angle
setup.HRIRs{k}.hrir_ref=loadHRIR('Anechoic', 80, 0, def.exppar1(k),'in-ear') setup.HRIRs{k}.hrir_ref=loadHRIR('Anechoic', 80, 0, def.exppar1(k),'in-ear')
......
...@@ -9,7 +9,7 @@ def.modelShowEnable = 0; ...@@ -9,7 +9,7 @@ def.modelShowEnable = 0;
def.markpressed = 1; def.markpressed = 1;
def.showEnable = 1; def.showEnable = 0;
def.showrun = 1; def.showrun = 1;
def.showtrial = 1; def.showtrial = 1;
def.showspec = 1; def.showspec = 1;
......
...@@ -8,14 +8,28 @@ global simwork ...@@ -8,14 +8,28 @@ global simwork
% we select only the left channels, the model is monaural % we select only the left channels, the model is monaural
simwork.tmpSig = work.signal; simwork.tmpSig = work.signal;
simwork.DOAaz = []; simwork.DOA = [];
for i=1:def.intervalnum for i=1:def.intervalnum
simwork.DOAaz(i) = eval([work.vpname '_preproc(simwork.tmpSig(:,2*i-1:2*i))']); % actual sig processing simwork.DOA(i) = eval([work.vpname '_preproc(simwork.tmpSig(:,2*i-1:2*i))']); % actual sig processing
end end
if unique(simwork.DOA)==1
response=3;
else
where=simwork.DOA(1)-simwork.DOA(2:3);
if where(1)==where(2)
response=1;
elseif where(1)==0
response=3;
elseif where(1)==0
response=2;
end
end
% now select the interval with the maximum standard deviation % now select the interval with the maximum standard deviation
[tmp,response] = max(simwork.actStd); % select max power % [tmp,response] = max(simwork.actStd); % select max power
% if it is another interval than the first, the response is wrong, since in the work.signal always carries the % if it is another interval than the first, the response is wrong, since in the work.signal always carries the
% signal interval in the first column % signal interval in the first column
...@@ -23,4 +37,7 @@ if response ~= 1 ...@@ -23,4 +37,7 @@ if response ~= 1
response = 0; response = 0;
end end
end
% eof % eof
...@@ -10,7 +10,7 @@ global simwork ...@@ -10,7 +10,7 @@ global simwork
addpath(genpath('/home/joanna/DOA4Seminars/DOASVMdemo')); addpath(genpath('/home/joanna/DOA4Seminars/DOASVMdemo'));
% load DOASVM model % load DOASVM model
simwork.sSensors = 'frontmiddle'; simwork.sSensors = 'inear';
simwork.sModeltype = 'HRIR'; simwork.sModeltype = 'HRIR';
simwork.LocModel = load(['LocModel_' simwork.sModeltype '_' simwork.sSensors]); simwork.LocModel = load(['LocModel_' simwork.sModeltype '_' simwork.sSensors]);
......
...@@ -8,7 +8,7 @@ global def ...@@ -8,7 +8,7 @@ global def
global work global work
% in this case the example model calls a detect routine for this, which returns 1 if the signal is detected. % in this case the example model calls a detect routine for this, which returns 1 if the signal is detected.
detect = eval([work.vpname '_detect']); detect = eval([work.vpname '_detect'])
% if detected than select the current signal position as the response interval, select a random one from the % if detected than select the current signal position as the response interval, select a random one from the
% remaining intervals otherwise % remaining intervals otherwise
......
% revision 1.00.1 beta, 07/01/04 % revision 1.00.1 beta, 07/01/04
function out = localizer_preproc(in) function DOA = localizer_preproc(in)
% in contains one of the 3 intervals presented in the experiment % in contains one of the 3 intervals presented in the experiment
global def global def
...@@ -10,6 +10,7 @@ global simwork ...@@ -10,6 +10,7 @@ global simwork
sig=in'; sig=in';
fs=def.samplerate; fs=def.samplerate;
DOAazimuth = simwork.LocModel.az;
time = 0:1./simwork.LocModel.fs.*simwork.LocModel.wndlen./2: size(sig,2)./simwork.LocModel.fs -1./simwork.LocModel.fs.*simwork.LocModel.wndlen; time = 0:1./simwork.LocModel.fs.*simwork.LocModel.wndlen./2: size(sig,2)./simwork.LocModel.fs -1./simwork.LocModel.fs.*simwork.LocModel.wndlen;
% STFT from Multi-Channel BSS Locate toolbox R. Lebarbenchon and E. Camberlein) % STFT from Multi-Channel BSS Locate toolbox R. Lebarbenchon and E. Camberlein)
...@@ -57,4 +58,14 @@ for IDXt = 1 : size(mFeature,2) ...@@ -57,4 +58,14 @@ for IDXt = 1 : size(mFeature,2)
% map to probability using a sigmoid transformation % map to probability using a sigmoid transformation
probability(:,IDXt) = 1 ./ (1 + exp(-(simwork.LocModel.x.' + c .* simwork.LocModel.y.'))); probability(:,IDXt) = 1 ./ (1 + exp(-(simwork.LocModel.x.' + c .* simwork.LocModel.y.')));
end end
\ No newline at end of file
[val indxdoa]=max(probability,[],1);
DOA=mode(DOAazimuth(indxdoa));
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