int data[] = wave.sampleData(channel);
for (int i = 0; i < nSamples; i++) {
samples[i] = (double)data[i];
}
FFT fft = new FFT(nSamples, window);
fft.transform(samples);
// Output the spectrum
double[] magnitude = fft.magnitudes();
final double stepHz = 2.0d * nSamples / (double)wave.sampleRate();
for (int i = 0; i < nSamples / 2; i++) {
System.out.println("" + (stepHz * i) + " " + magnitude[i]);
}