% lame encastree, partiels 1, 6.27, 17.55, 34.39
%-----------------------------------------------

clear all; close all;

Fe = 22050; h = 1/Fe;
f0 = 220; T =  2;
th = 0:h:T;

f = f0*[1 6.27 17.55 34.39];
am = [100 50 5 8];
n = length(am);

% somme des partiels
y = zeros(1,length(th));
for k = 1:n
    z = sin(2*pi*f(k)*th);
    y = y + am(k)*z;    
end

% enveloppe
tr = [0 .001 T*.98 T];
yr = [0  1  1 0];
y = y.*envelop(tr,yr,Fe);

y = .5*y/(max(abs(y)));
sound(y,Fe)
%wavwrite(y,Fe,'../SONS/208lamencastr1.wav');
pause(T+2)

y = y.*exp(-2*th)/.52;
sound(y,Fe)
%wavwrite(y,Fe,'../SONS/209lamencastr2.wav');
