function peaks = find_corr_peaks(vector, threshold);

  vecsize = size(vector, 2);

  peaks = find(vector > threshold & ...
               [%T (vector(2:vecsize) > vector(1:vecsize-1))] & ...
               [(vector(1:vecsize-1) > vector(2:vecsize)) %T]);

//end find_peaks

function tfgraph = time_freq_analyze(signal, period);

  siglength = size(signal, 2);

  n_frames = ceil(siglength/period);

  padding = zeros(1, n_frames*period-siglength);

  tfgraph = fft1d(matrix([signal padding], period, n_frames), -1);

//end time-freq_analyze

function bp = breakpoint_values(tf_matrix, harmonic_no, breakpoints);

  bp = tf_matrix(harmonic_no+1, breakpoints);

//end breakpoint_values

function bpt = breakpoint_times(breakpoints, period);

  bpt = (breakpoints - 1) * period / 44100;

//end breakpoint_times

function cslp = linseg_params(tf_matrix, harmonic_no, breakpoints, period);

  no_bps = size(breakpoints, 2);

  bpv = abs(breakpoint_values(tf_matrix, harmonic_no, breakpoints));

  ssv = max(bpv);

  bpv = bpv / ssv;

  bpt = breakpoint_times(breakpoints, period);

  bpd = bpt(2:no_bps) - bpt(1:no_bps-1);

  cslp = zeros(1, no_bps*2);

  for i = 1:no_bps-1 do

    cslp(i*2) = bpd(i);

  end //for i

  for i = 1:no_bps-1 do

    cslp(i*2+1) = bpv(i+1);

  end //for i

  cslp(no_bps*2) = ssv;

//end linseg_params;
