% son ascendant perpetuel (b)
% u_k(t) = sin(2*pi*phi_k(t))
% phi_k'(t) = (atan(alpha*t-k*dt)/pi+.5)*f/3
%-------------------------------------------

clear all; close all;

Fe = 22050; 
B = Fe/2.05; 
h = 1/Fe; T = 17;
t = 0:h:T;
lt = length(t);

alpha = .1; dt = .7;
y = zeros(1,lt);

for k = -10:20
   dphi = (atan(alpha*t-k*dt)/pi+.5)*Fe/3;
   phi = h*cumsum(dphi);
   env = (max((B-dphi)/B,0)).^2;
   y = y+env.*sin(2*pi*phi);
end

tr = T*[0 .4 .7 1];
yr = [0 .9 1 0];
env = envelop(tr,yr,Fe);
y = y.*env;
y = .98*y/max(abs(y));

sound(y,Fe);
%wavwrite(y,Fe,'../SONS/404monteeb.wav');
specgram(y);


