function y = synthfreqvec(v, freq, peak, t)
%y = synthfreqvec(v, freq, peak, t)
%this synthesis function will synthesize any linear combination of
%frequencies relative to those that appear in the input signal.
%v is a 2 column array.  The first column is a list of relative
%frequencies.  The second column is the relative peak that should be
%synthsized.  v should be curried before the function handler is sent to
%distort.
%examples:
%v = [1 1]: straight resynthesis takes place
%v = [2 1]: pitch shift- 1 octave up
%v = [.5 1]: pitch shift- 1 octave up
%v = [1.5 1]: pitch shift- 1.5 times the frequency
%v = [1 .7]
%    [2 .3]: mix in some second harmonic

a = size(v, 1);%number of rows in v
y = zeros(length(t),1);

for j=1:a
    for i = 1:length(freq)
        y = y + ( (peak(i)*v(j,2)) * sin(t * (freq(i)*v(j,1)) * 2*pi));
    end
end