Commit f58993cd authored by Joanna Luberadzka's avatar Joanna Luberadzka

changed names of the model-listener functions

parent 32d8c056
% 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
% 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
% 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
% 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
% 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
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