!7

lib 1009752 // musicg

import com.musicg.wave.Wave;
import com.musicg.fingerprint.FingerprintSimilarity;

static new L<S> names;
static new L<Wave> waves;

p {
  ZipFile zip = new ZipFile(loadLibrary(#1009759));
  for (S name : names = fileNamesInZip(zip))
    waves.add(new Wave(zipInputStream(zip, name)));
    
  names.add("computer-2.wav");
  waves.add(new Wave(f2s(loadLibrary(#1009763))));
  
  printStruct("Comparing: ", names);
  
  for (int i = 0; i < l(waves); i++)
    for (int j = 0; j < l(waves); j++) {
      if (i == j) continue;
      Wave w1 = waves.get(i), w2 = waves.get(j);
      FingerprintSimilarity fps = w1.getFingerprintSimilarity(w2);
      float score = fps.getScore();
      float sim = fps.getSimilarity();
      if (sim == 0) continue;
      print(names.get(i) + "/" 
        + names.get(j) + " score: " + score + (score == sim ? "" : " / " + sim));
    }
    
}