function y = hammond(f,t,Fe)
%        y = hammond(f,t,Fe)
% orgue avec effet leslie
%---------------------------

mu = .01;
eta = .3;
fL = 4;

h = 1/Fe;
th = 0:h:t;
nt = length(th);

% harmoniques
nh = 8; N = 1:nh;
ef1 = N.^(-2);
harm = N;

% plein-jeux
jeux = [1  2   3   4];
ej = [80 100 30  100];
nj = 2;

% ajout des harmoniques
yg = zeros(1,nt);
for l = 1:nj
    fh = jeux(l)*harm*f;
    ef = ej(l)*ef1;
    for k = 1:nh
        z = cos(fh(k)*(2*pi*th - mu*sin(2*pi*fL*th)/fL)).*(1 - eta*sin(2*pi*fL*th));
        yg = yg + ef(k)*z;   
    end
end

yd = zeros(1,nt);
for l = 1:nj
    fh = jeux(l)*harm*f;
    ef = ej(l)*ef1;
    for k = 1:nh
        z = cos(fh(k)*(2*pi*th + mu*sin(2*pi*fL*th)/fL)).*(1 + eta*sin(2*pi*fL*th));
        yd = yd + ef(k)*z;   
    end
end

% enveloppe
tr = [0 .09 t*.98 t];
yr = [0 1 .9 0];
env = envelop(tr,yr,Fe);

yg = yg.*env;
yg = yg/(max(abs(yg)));
yd = yd.*env;
yd = yd/(max(abs(yd)));

y = [yg', yd'];
return
% ajout du souffle
tr = t*[0 .1 .2 .8 1];
yr = [0 1 .7 .5 0];
env = envelop(tr,yr,Fe);
br = bruitc(1.5*f,Fe,nt);

br = br.*env;
br = br/(max(abs(br)));

y = br/20+y;
y = y/(max(abs(y)));





