Exemplo n.º 1
0
 /**
  * Performs a forward transform on the passed buffers.
  *
  * @param buffReal the real part of the time domain signal to transform
  * @param buffImag the imaginary part of the time domain signal to transform
  */
 public void forward(float[] buffReal, float[] buffImag) {
   if (buffReal.length != timeSize || buffImag.length != timeSize) {
     Minim.error("FFT.forward: The length of the passed buffers must be equal to timeSize().");
     return;
   }
   setComplex(buffReal, buffImag);
   bitReverseComplex();
   fft();
   fillSpectrum();
 }
Exemplo n.º 2
0
 @Override
 public void forward(float[] buffer) {
   if (buffer.length != timeSize) {
     Minim.error(
         "FFT.forward: The length of the passed sample buffer " + "must be equal to timeSize().");
     return;
   }
   doWindow(buffer);
   // copy samples to real/imag in bit-reversed order
   bitReverseSamples(buffer);
   // perform the fft
   fft();
   // fill the spectrum buffer with amplitudes
   fillSpectrum();
 }
Exemplo n.º 3
0
 @Override
 public void inverse(float[] buffer) {
   if (buffer.length > real.length) {
     Minim.error("FFT.inverse: the passed array's length must equal FFT.timeSize().");
     return;
   }
   // conjugate
   for (int i = 0; i < timeSize; i++) {
     imag[i] *= -1;
   }
   bitReverseComplex();
   fft();
   // copy the result in real into buffer, scaling as we do
   for (int i = 0; i < buffer.length; i++) {
     buffer[i] = real[i] / real.length;
   }
 }