function template1=taperer(template1,starttaperlength,endtaperlength)
%description: adds taper(s) to PSC template waveform
%calls: [no custom functions]
%called by: template_generator
%notes: time values in samples; important to consider the effects of taper(s) on template start time (if any) and template length
%code confirmed date: oct 31, 2012

if starttaperlength
    a=repmat(template1(1)/template1(2),1,starttaperlength); b=[length(a):-1:1]; c=a.^b;d=c*template1(1); template1=[d template1];
end

if endtaperlength
    a=repmat(template1(end)/template1(end-1),1,endtaperlength);b=[1:length(a)];c=a.^b;d=c*template1(end);template1=[template1 d];
end