
% AR_SYNTH_ZOE.M
%
% fait entendre la sequence A E I O U et 3 versions synthesisees
% a partir de modeles AR(20) estimes sur 512 points de chaque
% voyelle :
% - une synthese voisee (avec periode fondamentale)
% - une synthese non voisee (avec bruit en entree)
% - une vocalise sur le A

zoe = auread('zoe'); xx = zoe'; Fs = 44600; 

sound(xx(20001:120000),Fs) ;

pause

load ARsynth_zoe.mat

Fs = 44600 ;

%---- synthese normale

xA = zeros(1,8192) ;
jnd = 1:Pz_A:length(xA) ;
xA(jnd) = 1 ;
xsA = filter(1,Az_A,xA) ;
xsA = xsA/max(abs(xsA)) ;

xE = zeros(1,8192) ;
jnd = 1:Pz_E:length(xE) ;
xE(jnd) = 1 ;
xsE = filter(1,Az_E,xE) ;
xsE = xsE/max(abs(xsE)) ;

xI = zeros(1,8192) ;
jnd = 1:Pz_I:length(xI) ;
xI(jnd) = 1 ;
xsI = filter(1,Az_I,xI) ;
xsI = xsA/max(abs(xsI)) ;

xO = zeros(1,8192) ;
jnd = 1:Pz_O:length(xO) ;
xO(jnd) = 1 ;
xsO = filter(1,Az_O,xO) ;
xsO = xsO/max(abs(xsO)) ;

xU = zeros(1,8192) ;
jnd = 1:Pz_U:length(xU) ;
xU(jnd) = 1 ;
xsU = filter(1,Az_U,xU) ;
xsU = xsU/max(abs(xsU)) ;

xB = zeros(1,8192) ;
w = window(@hann,8192) ;

xs = [xB xsA.*w' xB xsE.*w' xB xsI.*w' xB xsO.*w' xB xsU.*w' xB] ;

sound(xs,Fs) ;

pause

%---- synthese bruit

xA = randn(1,8192) ;
xsA = filter(1,Az_A,xA) ;
xsA = xsA/max(abs(xsA)) ;

xE = randn(1,8192) ;
xsE = filter(1,Az_E,xE) ;
xsE = xsE/max(abs(xsE)) ;

xI = randn(1,8192) ;
xsI = filter(1,Az_I,xI) ;
xsI = xsA/max(abs(xsI)) ;

xO = randn(1,8192) ;
xsO = filter(1,Az_O,xO) ;
xsO = xsO/max(abs(xsO)) ;

xU = randn(1,8192) ;
xsU = filter(1,Az_U,xU) ;
xsU = xsU/max(abs(xsU)) ;

xB = zeros(1,8192) ;
w = window(@hann,8192) ;

xs = [xB xsA.*w' xB xsE.*w' xB xsI.*w' xB xsO.*w' xB xsU.*w' xB] ;

sound(xs,Fs) ;

pause

%---- vocalises

Pz_AV = fix(exp(linspace(log(Pz_A),log(Pz_A/2),4))) ;

xAf = zeros(1,8192) ;
jnd = 1:Pz_AV(1):8192 ;
xAf(jnd) = 1 ;
xsAf = filter(1,Az_A,xAf) ;
xsAf = xsAf/max(abs(xsAf)) ;

xAt = zeros(1,8192) ;
jnd = 1:Pz_AV(2):8192 ;
xAt(jnd) = 1 ;
xsAt = filter(1,Az_A,xAt) ;
xsAt = xsAt/max(abs(xsAt)) ;

xAq = zeros(1,8192) ;
jnd = 1:Pz_AV(3):8192 ;
xAq(jnd) = 1 ;
xsAq = filter(1,Az_A,xAq) ;
xsAq = xsAq/max(abs(xsAq)) ;

xAo = zeros(1,8192) ;
jnd = 1:Pz_AV(4):8192 ;
xAo(jnd) = 1 ;
xsAo = filter(1,Az_A,xAo) ;
xsAo = xsAo/max(abs(xsAo)) ;

xB = zeros(1,8192) ;
w = window(@hann,8192) ;

xs = [xB xsAf.*w' xB xsAt.*w' xB xsAq.*w' xB xsAo.*w' xB xsAq.*w' xB xsAt.*w' xB xsAf.*w' xB] ;

sound(xs,Fs) ;
