%%%Example on how to use ARTIND for Kryter method
% based on example from his 1962 paper. To plot the figure
% similar to the one in his paper, step inside the function
% from the MATLAB command prompt plot enter the following
% commands right before exiting the ARTIND function:
% semilogx(f,V+12)
% hold on;
% plot(f,Be)
% plot(f,noise_spec,'--')
clear all;clc
f=[270 380 490 630 770 920 1070 1230 1400 1570 ...
1740 1920 2130 2370 2660 3000 3400 3950 4650 5600]; %from Beranek
frange=[200 330 430 560 700 840 1000 1150 1310 ...
1480 1660 1830 2020 2240 2500 2820 3200 3650 4250 5050]; %fequency range for each band
Bsp=[50 50 48 45 43 40 37 34 32 31 29 28 26 25 24 23 21 20 19 18]; %ideal speech spectrum
%Speech level in dB SPL and specified frequencies (see help artind)
speech=Bsp+18;
%Example 1- System from original paper
%noise level in dB
noise=[-50 -40 -30 -20 -10 0 10 20 30 40 50 58 65 76 80 80 80 80 77 63];
%Systems response in dB SPL
R=zeros(1,20);
[AI,W,f]=artind(speech,R,noise,'kryter');
%Example 2- from Kryter based on 1962b paper on validation of the AI
c=-6;
%System 1- 1700 Hz Lowpass with skirt of 60 dB/octave
R1=sys2gain(f,1700,0,60);
R1(f<1700)=0;
[AI1,W,f]=artind(speech+c,R1,ones(1,20)*-180,'kryter');
%System 2- system 1 with 2400-3400 Hz noise
data=zeros(2,100);
for i=1:100,
gain=i;
noiseA=sys2gain(f,2400,gain,-60);
noiseB=sys2gain(f,3400,gain,60);
noise=noiseA.*(f<2400) + noiseB.*(f>3400);
noise(f>=2400 & f<=3400)=gain;
[AI2,W,f]=artind(speech+c,R1,noise,'kryter');
data(:,i)=[gain AI2];
end
% plot(data(1,:),data(2,:))
%System 3- 1700 Hz Highpass with skirt of 60 dB/octave
data=zeros(2,61);
i=1;
for b=-50:10,
R3=sys2gain(f,1700,0,-60);
R3(f>1700)=0;
[AI3,W,f]=artind(speech+b,R3,ones(1,20)*-180,'kryter');
data(:,i)=[b AI3];
i=i+1;
end
plot(data(1,:),data(2,:))
%System 4- system 3 with 200-1200 Hz noise
data=zeros(2,100);
for i=1:100,
gain=i;
noiseA=sys2gain(f,200,gain,-60);
noiseB=sys2gain(f,1200,gain,60);
noise=noiseA.*(f<200) + noiseB.*(f>1200);
noise(f>=200 & f<=1200)=gain;
[AI4,W,f]=artind(speech+c,R3,noise,'kryter');
data(:,i)=[gain AI2];
end
% figure
% plot(data(1,:),data(2,:))
%System 5- 1200-2400 passband speech
A=sys2gain(f,1200,0,-60);
B=sys2gain(f,2400,0,60);
R5=A.*(f<1200) + B.*(f>2400);
R5(f>=1200 & f<=2400)=0;
[AI5,W,f]=artind(speech+c,R5,ones(1,20)*-180,'kryter');
%System 6- 1700-2400 passband speech
A=sys2gain(f,1700,0,-60);
B=sys2gain(f,2400,0,60);
R6=A.*(f<1700) + B.*(f>2400);
R6(f>=1700 & f<=2400)=0;
[AI6,W,f]=artind(speech+c,R6,ones(1,20)*-180,'kryter');
%System 7- 1200-1700 passband speech
A=sys2gain(f,1200,0,-60);
B=sys2gain(f,1700,0,60);
R7=A.*(f<1200) + B.*(f>1700);
R7(f>=1200 & f<=1700)=0;
[AI7,W,f]=artind(speech+c,R7,ones(1,20)*-180,'kryter');
x=[AI1 AI3 AI5 AI6 AI7];
stem(x)