% Demo1
%
% This simple demonstration shows how to compute 'auditory spectrogram'
% for a signal and a distorted signal. 
% 

% Model is defined here. It could be also defined in a separate file,
% e.g., Profile_demo1.m. In this case it could called by
% A=AudMod(sig,'Profile_demo1.m').
model.fs=44100;
model.outmid.file='demo1_oem.mat'; % An ELC correction filter
model.cochlea.fb.file='gt128.mat'; % A 128-channel gammatone filterbank
model.haircell.rcf.r='half';       % Half-wave rectification
model.haircell.rcf.c='Plack98';    % A non-linear compr. function
model.haircell.rcf.f='no';         % No smoothing
model.neural.function='sum';       % Sum over all samples
model.pp.mapping='decibel';        % Conversion to dB scale

% Signal
load Soprano;       % The original signal sig
dsig=min(sig,2500); % A slightly distorted version of sig
% Processing
A=AudMod(sig,model);
dA=AudMod(dsig,model);

load gt128.mat; % This file also has the center frequencies of the filters
               
% Figure
semilogx(CentFreqs,A,'-',CentFreqs,dA,'--');
xlabel('Frequency [Hz]');ylabel('Excitation');
text(300,70,'solid - original soprano');
text(300,65,'dashed - distorted soprano');
title('There is some probably audible distortion above 2 kHz -> demo2');

