%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%% Initiation %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Add clear message
clear

% load sound file 'ha.wav'
[VOX, fs] = wavread('VOX1.wav');


% display in the command window the message:
display = '\n Select delay-line width (milliseconds) value, use the range 0.5-2 ms\n\n >';


% assign the selected input to variable Width
Width= input(display);

% convert milliseconds to seconds
Width=Width*0.001;

% display in the command window the message:

display = '\n Select frequency modulator depth (Hz) value, use the range 2-5 Hz\n\n >';
% assign the selected input to variable Depth
Depth = input(display);

display = '\n Select the rate of tremolo between 0.5-2\n\n>';
Fc=input(display);

display='\n Select the effect to add: vibrato, tremolo or vibrato_tremolo\n\n>';
%selects which function to use
function_select=input(display,'s');

%use if statement with strcmp function to compare between the functions

if strcmp('vibrato',function_select)
    vibratoVOX = vibrato(VOX, fs, Depth, Width);
    %soundfile with only vibrato
    sound(vibratoVOX,fs);
    wavwrite(vibratoVOX,fs,'only_vibratoVOX.wav');
    
elseif strcmp('tremolo',function_select)
    %only tremolo%
    tremoloVOX=ammod(VOX,Fc,fs);
    %audition and create sound file with only tremolo
    sound(tremoloVOX,fs);
    wavwrite(tremoloVOX,fs,'only_tremoloVOX.wav');
    
elseif strcmp('vibrato_tremolo',function_select)
    % use the vibrato function to add delay modulation to the filtered signal
    vibratoVOX = vibrato(VOX, fs, Depth, Width);
    vibrato_tremoloVOX=ammod(vibratoVOX,Fc,fs); 
    %amplitude modulation function
    %to add tremolo at the same rate as the vibrato
    %audition and create sound file with vibrato and tremolo
    sound(vibrato_tremoloVOX,fs);
    wavwrite(vibrato_tremoloVOX,fs,'vibrato_tremoloVOX.wav');


else
    error ('Your selection is invalid');
end







