コード例 #1
0
 public KeyProbabilitySet getNormalizedProbabilities() {
   double[] normalizedProbabilities = new double[12];
   double minimum = Double.MAX_VALUE;
   for (int i = 0; i < 12; ++i) {
     if (probability[i] < minimum) minimum = probability[i];
   }
   int index = 0;
   for (int i = 0; i < 12; ++i) {
     normalizedProbabilities[index] = probability[i] - minimum;
     index += 7;
     if (index >= 12) index -= 12;
   }
   double total = 0;
   for (int i = 0; i < 12; ++i) total += normalizedProbabilities[i];
   for (int i = 0; i < 12; ++i) normalizedProbabilities[i] = normalizedProbabilities[i] / total;
   return new KeyProbabilitySet(normalizedProbabilities, spiralKey.isMajor(), spiralKey.getType());
 }
コード例 #2
0
 private void processData(double[] circle5ths_buffer) {
   Point centerEffect = SpiralArray.getCenterPoint(circle5ths_buffer);
   if (centerEffect != null) spiralKey.getKeyProbabilities(centerEffect, probability);
 }