% Demo3
%
% Step responses of three different neural adaptation models
% as a function of level.
%

clear model;
model.fs=44100; % Sampling rate

% Create excitations
sig=ones(1,5000);
S=[Pascalize(sig,40)' Pascalize(sig,50)' Pascalize(sig,60)'];
S=[ones(5000,3);S;ones(5000,3)];  

% Adaptation network by (Dau & Puschel, 1996)
model.neural.function='Dau96';
model.neural.Dau.thr=0.05;

a2=AudMod(S,model);

% Adaptation model by (Karjalainen, 1996)
model.neural.function='Karjalainen96';
model.neural.Karjalainen.slow=1;

a3=AudMod(S,model);

% Temporal window model (Plack & Moore, 1998)
model.haircell.rcf.r='half';
model.haircell.rcf.c='Plack98';
model.haircell.rcf.f='no';
model.neural.function='Plack98';
a1=AudMod(S,model);

t=linspace(0,length(S)/44.1,length(S));
subplot(4,1,1),plot(t,S);title('Excitation at three levels');
set(gca,'xticklabel',[]);
subplot(4,1,2),plot(t,a1);title('Plack98');set(gca,'xticklabel',[]);
subplot(4,1,3),plot(t,a2);title('Dau96');set(gca,'xticklabel',[]);
subplot(4,1,4),plot(t,a3);title('Karjalainen96');xlabel('Time [ms]');

