% tremolo2.m
% Tremolo via triangular wave ring modulatin

% read the sample waveform
filename='acoustic.wav';
[x,Fs] = audioread(filename);


% create triangular wave LFO
delta=5e-4;
minf=-0.5;
maxf=0.5;

trem=minf:delta:maxf;
while(length(trem) < length(x) )
    trem=[trem (maxf:-delta:minf)];
    trem=[trem (minf:delta:maxf)];
end

%trim trem
trem = trem(1:length(x))';
plot(trem);

%Ring mod with triangualar, trem
y= x.*trem;

% write output
audiowrite('out_tremolo2.wav', y,Fs);