return null;
}
for (int chunkNum = 0; chunkNum < numChunks; chunkNum++)
{
FeatChunk fC = (FeatChunk)chunks.elementAt(chunkNum);
double chromas[] = fC.getFeatureByName("AvgChroma");
double chromasSort[] = fC.getFeatureByName("AvgChroma");
Arrays.sort(chromasSort);
int firstChroma = -1;
int secondChroma = -1;
int thirdChroma = -1;
//System.out.println("chromasSort[0]: " + chromasSort[0] + " chromasSort[11]: " + chromasSort[11]);
for (int i = 0; i < 12; i++)
{
if (chromasSort[11] == chromas[i])
{
firstChroma = i;
//System.out.println("fC: " + i + " value: " + chromas[i]);
}
if (chromasSort[10] == chromas[i])
{
secondChroma = i;
//System.out.println("sC: " + i + " value: " + chromas[i]);
}
if (chromasSort[9] == chromas[i])
{
thirdChroma = i;
//System.out.println("tC: " + i + " value: " + chromas[i]);
}
}
try
{
out.write("WAVETABLE(" + fC.startTime + ", " + fC.length +
", " + chromasSort[11] * 20000 + " * ampenv, " +
(6.0 + (firstChroma * 0.01)) + ", 0.5, waveform)\n");
out.write("WAVETABLE(" + fC.startTime + ", " + fC.length +
", " + chromasSort[10] * 15000 + " * ampenv, " +
(6.0 + (secondChroma * 0.01)) + ", 0.25, waveform)\n");
out.write("WAVETABLE(" + fC.startTime + ", " + fC.length +
", " + chromasSort[9] * 15000 + " * ampenv, " +
(6.0 + (thirdChroma * 0.01)) + ", 0.75, waveform)\n");
out.write("WAVETABLE(" + fC.startTime + ", " + fC.length +
", " + chromasSort[11] * 20000 + " * ampenv, " +
(8.0 + (firstChroma * 0.01)) + ", 0.5, waveform)\n");
out.write("WAVETABLE(" + fC.startTime + ", " + fC.length +
", " + chromasSort[10] * 15000 + " * ampenv, " +
(8.0 + (secondChroma * 0.01)) + ", 0.75, waveform)\n");
out.write("WAVETABLE(" + fC.startTime + ", " + fC.length +
", " + chromasSort[9] * 15000 + " * ampenv, " +
(8.0 + (thirdChroma * 0.01)) + ", 0.25, waveform)\n");
}
catch (Exception e)
{
}
for (int i = 0; i < 12; i++)
{
if (firstChroma != i &&
secondChroma != i &&
thirdChroma != i)
{
chromas[i] = 0.0;
}
}
fC.clearFeatures();
fC.addFeature(chromas);
outFile.chunks.add(fC);
}