% Script that calls the function cepstrum_cross_synthesis
% This script is turned into a function for the final sound out convolution
% process.

function[cepstrum_sound_out,fs]=cepstrum_cross_synthesis_script

[x1,fs]=audioread('Trombone.wav'); %x1 is used as the excitation signal
[x2,fs]=audioread('Xylophone.wav');%x2 is used as the spectral envelope to be imposed

WLen=2048;  %Window size in samples
n1=512;  %Hop size for analysis in samples
w1=hann(WLen);  %Window type for analysis
order1=20;  %Cut frequency for sound 1
order2=20;  %Cut frequency for sound 2
%Cut frequency is the upper limit for the spectral envelope in samples.  A
%low value will smooth out the spectral envelope while a higher value will 
%include some of the harmonic peaks in the spectral envelope.  
%Cut frequency should be less than the period of the analyzed sound.

%'whitening' is the process of removing the spectal envelope of the
%excitation sound before applying the spectral envelope of the second sound
%Options are given as to whether to remove the formants of the excitation 
%sound before imposing the formants of sound 2, or whether to impose the 
%formants of sound 2 directly onto sound 1.

%option1=formants of excitation sound not removed
%option2=formants of excitation sound are removed
option=2;

%Call the function for cepstrum cross synthesis effect
[cepstrum_sound_out]=cepstrum_cross_synthesis(x1,x2,WLen,n1,w1,order1,...
    order2,option);
