% differents sons wawa
%---------------------

clear all; close all;

Fe = 22050; h = 1/Fe;
f = 440; T = 2;
fcm = 500;
fwa = 2;
fexc = .5*fcm;

% bruit blanc
%------------
n = 2*Fe+1;
rd = randn(1,n);
rd = .15*rd/max(abs(rd));
sound(rd,Fe); pause(T+1);
%wavwrite(rd,Fe,'../SONS/608bruitw.wav');

th = h*(1:n);
fc = fcm+fexc*sin(2*pi*fwa*th);
fb = fc/10;
type = 'pb';

% bruit blanc wawate
%-------------------
y1 = wawa(rd,Fe,fc,fb,type);
y1 = .5*y1/max(abs(y1));
sound(y1,Fe); pause(T+1);
%wavwrite(y1,Fe,'../SONS/609wawabruit.wav');

% flute
%------
x = flute(f,T,Fe);
x = .8*x/max(abs(x));
sound(x,Fe); pause(T+1);
%wavwrite(x,Fe,'../SONS/610flutew.wav');

% flute wawatante
%----------------
y2 = wawa(x,Fe,fc,fb,type);
sound(y2,Fe); pause(T+1);
%wavwrite(y2,Fe,'../SONS/611wawaflute.wav');


% visualisation
%--------------
figure(1);
subplot(1,2,1);
voirspec(rd,Fe,3000,512);
subplot(1,2,2);
voirspec(y1,Fe,3000,512);

figure(2);
subplot(1,2,1);
voirspec(x,Fe,3000,512);
subplot(1,2,2);
voirspec(y2,Fe,3000,512);

