function newsounds = isNew(F, onsets)

% Going in order, determine if the next feature in the matrix F is
% similar to one of the old ones or is new.  Clustering but needs to
% be online.  Keep first member as representative.  Return indices
% of representatives.

reps = F(1,:);
newsounds = onsets(1);
nreps = 1;
thresh = 0.8;

for i=2:size(F,1);
  % Euclidean distance
  d = sum((reps - repmat(F(i,:), nreps, 1)).^2, 2);
  if(min(d) > thresh)
    min(d)
    nreps = nreps + 1;
    reps(nreps, :) = F(i,:);
    newsounds(nreps) = onsets(i);
  end
end

fprintf('Accepted %d out of %d\n', nreps, size(F,1))
