docs: public double[] getMagnitudes(double[] amplitudes, boolean complex) {
  
          final int sampleSize = amplitudes.length;
          final int nrofFrequencyBins = sampleSize / 2;
  
  
          // call the fft and transform the complex numbers
          if (complex) {
              DoubleFFT_1D fft = new DoubleFFT_1D(nrofFrequencyBins);
              fft.complexForward(amplitudes);
          } else {
              DoubleFFT_1D fft = new DoubleFFT_1D(sampleSize);
              fft.realForward(amplitudes);
              // amplitudes[1] contains re[sampleSize/2] or im[(sampleSize-1) / 2] (depending on whether sampleSize is odd or even)
              // Discard it as it is useless without the other part
              // im part dc bin is always 0 for real input
              amplitudes[1] = 0;
          }
          // end call the fft and transform the complex numbers
  
          // even indexes (0,2,4,6,...) are real parts
          // odd indexes (1,3,5,7,...) are img parts
          double[] mag = new double[nrofFrequencyBins];
          for (int i = 0; i < nrofFrequencyBins; i++) {
              final int f = 2 * i;
              mag[i] = Math.sqrt(amplitudes[f] * amplitudes[f] + amplitudes[f + 1] * amplitudes[f + 1]);
          }
  
          return mag;
      }