Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DOA4Seminars
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joanna Luberadzka
DOA4Seminars
Commits
9564d0d1
Commit
9564d0d1
authored
Nov 01, 2017
by
Joanna Luberadzka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AFC experiment for localization
parent
b331a830
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
173 deletions
+46
-173
afc/experimentDOA_cfg.m
afc/experimentDOA_cfg.m
+5
-5
afc/experimentDOA_set.m
afc/experimentDOA_set.m
+5
-10
afc/experimentDOA_user.m
afc/experimentDOA_user.m
+36
-24
afc/models/exampleDOA_cfg.m
afc/models/exampleDOA_cfg.m
+0
-17
afc/models/exampleDOA_detect.m
afc/models/exampleDOA_detect.m
+0
-26
afc/models/exampleDOA_init.m
afc/models/exampleDOA_init.m
+0
-19
afc/models/exampleDOA_main.m
afc/models/exampleDOA_main.m
+0
-46
afc/models/exampleDOA_preproc.m
afc/models/exampleDOA_preproc.m
+0
-26
No files found.
afc/experimentDOA_cfg.m
View file @
9564d0d1
...
...
@@ -22,19 +22,19 @@ def.ollodir='/media/joanna/daten/user/joanna/Data/my_OLLO/OLLO_data/OLLO2.0_NO/'
def
.
measurementProcedure
=
'transformedUpDown'
;
% measurement procedure
def
.
intervalnum
=
3
;
% number of intervals
def
.
rule
=
[
1
2
];
% [up down]-rule: [1 2] = 1-up 2-down
def
.
varstep
=
[
4
2
1
];
% [starting stepsize ... minimum stepsize] of the tracking variable
def
.
varstep
=
[
8
5
1
];
% [starting stepsize ... minimum stepsize] of the tracking variable
def
.
steprule
=
-
1
;
% stepsize is changed after each upper (-1) or lower (1) reversal
def
.
reversalnum
=
6
;
% number of reversals in measurement phase
def
.
repeatnum
=
1
;
% number of repeatitions of the experiment
% experimental variable (result of procedure yields dependent variable)
def
.
startvar
=
5
;
% starting value of the tracking variable
def
.
startvar
=
5
0
;
% starting value of the tracking variable
def
.
expvarunit
=
'dB'
;
% unit of the tracking variable
def
.
expvardescription
=
'
noise
level'
;
% description of the tracking variable
def
.
expvardescription
=
'
signal
level'
;
% description of the tracking variable
% limits for experimental variable
def
.
minvar
=
100
;
% minimum value of the tracking variable
def
.
maxvar
=
0
;
% maximum value of the tracking variable
def
.
minvar
=
-
100
;
% minimum value of the tracking variable
def
.
maxvar
=
10
0
;
% maximum value of the tracking variable
def
.
terminate
=
1
;
% terminate execution on min/maxvar hit: 0 = warning, 1 = terminate
def
.
endstop
=
3
;
% Allows x nominal levels higher/lower than the limits before terminating (if def.terminate = 1)
...
...
afc/experimentDOA_set.m
View file @
9564d0d1
...
...
@@ -27,7 +27,7 @@ global work
global
setup
% conditions are specified in each run by:
% afc('main','experimentDOA','subject','5deg','
female','babbl
e')
% afc('main','experimentDOA','subject','5deg','
ollo_female','whit
e')
% Condition 1
switch
work
.
userpar1
...
...
@@ -61,12 +61,12 @@ end
% define the calibration level (assume 90 dB SPL for 0 dB FS)
work
.
currentCalLevel
=
100
;
work
.
currentCalLevel
=
90
;
setup
.
level
=
40
;
% define signals in structure setup
% setup.modsine = sin([0:def.intervallen-1]'*2*pi*work.exppar1/def.samplerate);
setup
.
hannlen
=
round
(
0.05
*
def
.
samplerate
);
setup
.
window
=
hannfl
(
def
.
intervallen
,
setup
.
hannlen
,
setup
.
hannlen
);
% make a list of files from which one file should be
% randomly chosen in each trial
...
...
@@ -79,7 +79,7 @@ addpath(genpath(def.hrirdir))
% create a cell array which has the same lenght as
% the number of referece angles that we want to test
setup
.
HRIRs
=
cell
(
length
(
def
.
exppar1
),
1
)
for
k
=
1
:
leng
ht
(
setup
.
HRIRs
)
for
k
=
1
:
leng
th
(
setup
.
HRIRs
)
%load the hrir for the reference angle
setup
.
HRIRs
{
k
}
.
hrir_ref
=
loadHRIR
(
'Anechoic'
,
80
,
0
,
def
.
exppar1
(
k
),
'in-ear'
)
%load the hrirs for the angle 5° away from the reference angle
...
...
@@ -88,9 +88,4 @@ for k=1:lenght(setup.HRIRs)
end
% eof
\ No newline at end of file
afc/experimentDOA_user.m
View file @
9564d0d1
...
...
@@ -45,43 +45,51 @@ global setup
numberOfFiles
=
length
(
setup
.
waveFiles
);
fileToPlay
=
randi
(
numberOfFiles
,
1
);
baseWavFileName
=
setup
.
waveFiles
(
fileToPlay
)
.
name
;
fullWavFileName
=
fullfile
([
def
.
ollo
dir
,
baseWavFileName
]);
fullWavFileName
=
fullfile
([
setup
.
file
dir
,
baseWavFileName
]);
[
sig
fssig
]
=
audioread
(
fullWavFileName
);
% resample the signal
[
P
,
Q
]
=
rat
(
def
.
samplerate
/
fssig
);
sig
=
resample
(
sig
,
P
,
Q
);
sig_level
=
work
.
expvaract
;
sig
=
sig
.*
10
^
((
sig_level
-
work
.
currentCalLevel
)/
20
);
% choose hrir:
% * find which reference angle is currently tested
% * randomly choose +or- 5or10 deg
indx
=
find
(
def
.
exppar
==
work
.
exppar1
);
hrir_ref
=
setup
.
HRIRs
{
indx
}
.
hrir_ref
;
plusorminus
=
randi
(
2
)
def
.
exppar1
indx
=
find
(
def
.
exppar1
==
work
.
exppar1
);
hrir_ref
=
setup
.
HRIRs
{
indx
}
.
hrir_ref
.
data
;
plusorminus
=
randi
(
2
);
if
plusorminus
==
1
hrir_targ
=
setup
.
HRIRs
{
indx
}
.
hrir_refplus
;
hrir_targ
=
setup
.
HRIRs
{
indx
}
.
hrir_refplus
.
data
;
elseif
plusorminus
==
2
hrir_targ
=
setup
.
HRIRs
{
indx
}
.
hrir_refminus
;
hrir_targ
=
setup
.
HRIRs
{
indx
}
.
hrir_refminus
.
data
;
end
% convolve signals
sig_ref
(
1
,:)
=
conv
(
sig
(
1
,:),
hrir_ref
(
1
,:
));
sig_ref
(
2
,:)
=
conv
(
sig
(
2
,:),
hrir_ref
(
2
,:
));
sig_targ
(
1
,:)
=
conv
(
sig
(
1
,:),
hrir_targ
(
1
,:
));
sig_targ
(
2
,:)
=
conv
(
sig
(
1
,:),
hrir_targ
(
1
,:
));
sig_ref
(
1
,:)
=
conv
(
sig
,
hrir_ref
(:,
1
));
sig_ref
(
2
,:)
=
conv
(
sig
,
hrir_ref
(:,
2
));
sig_targ
(
1
,:)
=
conv
(
sig
,
hrir_targ
(:,
1
));
sig_targ
(
2
,:)
=
conv
(
sig
,
hrir_targ
(:,
2
));
noise_level
=
setup
.
level
;
noise
=
setup
.
noise
.*
10
^
((
noise_level
-
work
.
currentCalLevel
)/
20
);
%here scale the noise so that it has level according
% to the current tracking variable work.expvaract
% provide 3 randomly cut excerpts of noise
L
=
length
(
sig
)
+
length
(
hrir_targ
)
-
1
;
start1
=
randi
(
length
(
noise
)
-
L
);
noise1
=
noise
(
start1
+
1
:
start1
+
L
);
start2
=
randi
(
length
(
noise
)
-
L
);
noise2
=
noise
(
start2
+
1
:
start2
+
L
);
start3
=
randi
(
length
(
noise
)
-
L
);
noise3
=
noise
(
start3
+
1
:
start3
+
L
);
% LEVELS: here scale the noise so that it has level according
% to the current tracking variable work.expvaract
% provide 3 randomly cut excerpts of noise
L
=
length
(
sig
)
+
length
(
hrir_targ
)
-
1
;
sig_noise1
=
noise
(
randi
(
length
(
noise
)):
randi
(
length
(
noise
))
+
L
)
sig_noise2
=
noise
(
randi
(
length
(
noise
)):
randi
(
length
(
noise
))
+
L
)
sig_noise3
=
noise
(
randi
(
length
(
noise
)):
randi
(
length
(
noise
))
+
L
)
% tref1 = real(ifft(scut(fft(randn(def.intervallen,1)),1000,4000,def.samplerate))) * 10^((setup.level - work.currentCalLevel)/20);
...
...
@@ -89,12 +97,16 @@ sig_noise3=noise(randi(length(noise)):randi(length(noise))+L)
% tuser = real(ifft(scut(fft(randn(def.intervallen,1)),1000,4000,def.samplerate))) * 10^((setup.level - work.currentCalLevel)/20) .* ... // holds the target signal
% (1 + (10^(work.expvaract/20) * setup.modsine));
tref11
=
(
sig_ref
(
1
,:)
+
sig_noise1
)
.*
setup
.
window
;
tref12
=
(
sig_ref
(
2
,:)
+
sig_noise1
)
.*
setup
.
window
;
tref21
=
(
sig_ref
(
1
,:)
+
sig_noise2
)
.*
setup
.
window
;
tref22
=
(
sig_ref
(
2
,:)
+
sig_noise2
)
.*
setup
.
window
;
tuser1
=
(
sig_targ
(
1
,:)
+
sig_noise3
)
.*
setup
.
window
;
tuser2
=
(
sig_targ
(
2
,:)
+
sig_noise3
)
.*
setup
.
window
;
%window
setup
.
hannlen
=
round
(
0.05
*
def
.
samplerate
);
setup
.
window
=
hannfl
(
L
,
setup
.
hannlen
,
setup
.
hannlen
)
'
;
tref11
=
(
sig_ref
(
1
,:)
+
noise1
)
.*
setup
.
window
;
tref12
=
(
sig_ref
(
2
,:)
+
noise1
)
.*
setup
.
window
;
tref21
=
(
sig_ref
(
1
,:)
+
noise2
)
.*
setup
.
window
;
tref22
=
(
sig_ref
(
2
,:)
+
noise2
)
.*
setup
.
window
;
tuser1
=
(
sig_targ
(
1
,:)
+
noise3
)
.*
setup
.
window
;
tuser2
=
(
sig_targ
(
2
,:)
+
noise3
)
.*
setup
.
window
;
% pre-, post- and pausesignals (all zeros)
...
...
@@ -105,7 +117,7 @@ pausesig = zeros(def.pauselen,2);
% make required fields in work
work
.
signal
=
[
tuser1
tuser2
tref11
tref12
tref21
tref22
];
% left = right (diotic) first two columns holds the test signal (left right)
work
.
signal
=
[
tuser1
' tuser2'
tref11
' tref12'
tref21
' tref22'
];
% left = right (diotic) first two columns holds the test signal (left right)
work
.
presig
=
presig
;
% must contain the presignal
work
.
postsig
=
postsig
;
% must contain the postsignal
work
.
pausesig
=
pausesig
;
% must contain the pausesignal
...
...
afc/models/exampleDOA_cfg.m
deleted
100644 → 0
View file @
b331a830
% specify that subject "exampleArtificialListener" is actually a model
% and disable the response box and sound output etc.
def
.
modelEnable
=
1
;
def
.
afcwinEnable
=
1
;
def
.
soundEnable
=
1
;
def
.
modelDisplayEnable
=
1
;
def
.
modelShowEnable
=
0
;
def
.
markpressed
=
1
;
def
.
showEnable
=
1
;
def
.
showrun
=
1
;
def
.
showtrial
=
1
;
def
.
showspec
=
1
;
% eof
afc/models/exampleDOA_detect.m
deleted
100644 → 0
View file @
b331a830
% revision 1.00.1 beta, 07/01/04
function
response
=
exampleDOA_detect
global
def
global
work
global
simwork
% we select only the left channels, the model is monaural
simwork
.
tmpSig
=
work
.
signal
;
simwork
.
DOAaz
=
[];
for
i
=
1
:
def
.
intervalnum
simwork
.
DOAaz
(
i
)
=
eval
([
work
.
vpname
'_preproc(simwork.tmpSig(:,2*i-1:2*i))'
]);
% actual sig processing
end
% now select the interval with the maximum standard deviation
[
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
% signal interval in the first column
if
response
~=
1
response
=
0
;
end
% eof
afc/models/exampleDOA_init.m
deleted
100644 → 0
View file @
b331a830
% revision 1.00.1 beta, 07/01/04
function
exampleDOA_init
% this file is used to initialize model parameters
global
def
global
work
global
simwork
% the example model is so simple, there is not much to initialize.
% Some filter coefficients used in example_preproc
% 4-6 kHz four-pole Butterworth Bandpass (missing)
% first-order lowpass filter @ 65 Hz
[
simwork
.
lp_b
,
simwork
.
lp_a
]
=
folp
(
65
,
def
.
samplerate
);
%eof
afc/models/exampleDOA_main.m
deleted
100644 → 0
View file @
b331a830
% revision 1.00.1 beta, 07/01/04
function
response
=
exampleDOA_main
% the model_main function must return the presentation interval selected by the model
global
def
global
work
% 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'
]);
% if detected than select the current signal position as the response interval, select a random one from the
% remaining intervals otherwise
switch
detect
case
1
response
=
work
.
position
{
work
.
pvind
}(
end
);
case
0
responseTmp
=
randperm
(
def
.
intervalnum
);
response
=
work
.
position
{
work
.
pvind
}(
end
);
i
=
1
;
while
(
response
==
work
.
position
{
work
.
pvind
}(
end
)
)
response
=
responseTmp
(
i
);
i
=
i
+
1
;
end
end
% the model also displays some info in the matlab workspace window
% might also go to an extra function "example_display"
if
(
def
.
modelDisplayEnable
)
if
detect
==
1
r
=
'correct'
;
% correct response
else
r
=
'false'
;
% false response
end
if
(
work
.
stepnum
{
work
.
pvind
}(
end
)
==
1
)
disp
(
'starting new run ...'
);
end
disp
([
'step '
num2str
(
work
.
stepnum
{
work
.
pvind
}(
end
))
' '
r
]);
end
% eof
afc/models/exampleDOA_preproc.m
deleted
100644 → 0
View file @
b331a830
% revision 1.00.1 beta, 07/01/04
function
out
=
exampleDOA_preproc
(
in
)
% in contains one of the 3 intervals presented in the experiment
global
def
global
work
global
simwork
% this is the Viemeister JASA 1979 leaky-integrator model
% 4-6 kHz four-pole Butterworth Bandpass (missing)
% halfwave rectification
tmp
=
max
(
in
,
0
);
% first-order lowpass filter @ 65 Hz
tmp
=
filter
(
simwork
.
lp_b
,
simwork
.
lp_a
,
tmp
);
% ac-coupled rms = std
out
=
std
(
tmp
,
1
);
% that's it
% eof
% [probability DOAazimuth time] = DOASVMloc1(sig,fs)
\ No newline at end of file
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