All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sciss.fscape.stream.FFT.scala Maven / Gradle / Ivy

/*
 *  FFT.scala
 *  (FScape)
 *
 *  Copyright (c) 2001-2016 Hanns Holger Rutz. All rights reserved.
 *
 *  This software is published under the GNU General Public License v2+
 *
 *
 *  For further information, please contact Hanns Holger Rutz at
 *  [email protected]
 */

package de.sciss.fscape.stream

import de.sciss.fscape.stream.impl.{Complex1FFTStageImpl, Complex1IFFTStageImpl, Real1FFTStageImpl, Real1FullFFTStageImpl, Real1FullIFFTStageImpl, Real1IFFTStageImpl}

/** Real (positive spectrum) forward Short Time Fourier Transform.
  * The counter-part of it is `Real1IFFT`.
  *
  * Useful page: http://calculator.vhex.net/calculator/fast-fourier-transform-calculator-fft/1d-discrete-fourier-transform
  */
object Real1FFT {
  def apply(in: OutD, size: OutI, padding: OutI)(implicit b: Builder): OutD = {
    // XXX TODO:
    println("WARNING: Real1FFT --- returned packed format") // (Re(DC), Re(Ny), Re(1), Im(1) etc.
    new Real1FFTStageImpl().connect(in = in, size = size, padding = padding)
  }
}

/** Real (positive spectrum) inverse Short Time Fourier Transform.
  * The counter-part of `Real1FFT`.
  */
object Real1IFFT {
  def apply(in: OutD, size: OutI, padding: OutI)(implicit b: Builder): OutD =
    new Real1IFFTStageImpl().connect(in = in, size = size, padding = padding)
}

/** Real (full spectrum) forward Short Time Fourier Transform.
  * This produces a symmetric spectrum (redundant) spectrum, whereas
  * `Real1FFT` only produces half of the spectrum.
  * The counter-part of it is `Real1FullIFFT`.
  */
object Real1FullFFT {
  def apply(in: OutD, size: OutI, padding: OutI)(implicit b: Builder): OutD =
    new Real1FullFFTStageImpl().connect(in = in, size = size, padding = padding)
}

/** Real (full spectrum) inverse Short Time Fourier Transform.
  * This is the counter-part to `Real1FullFFT`. It assumes
  * the input is a complex spectrum of a real signal, and after the IFFT
  * drops the imaginary part.
  */
object Real1FullIFFT {
  def apply(in: OutD, size: OutI, padding: OutI)(implicit b: Builder): OutD =
    new Real1FullIFFTStageImpl().connect(in = in, size = size, padding = padding)
}

/** Complex forward Short Time Fourier Transform.
  * The counter-part of it is `Complex1IFFT`.
  */
object Complex1FFT {
  def apply(in: OutD, size: OutI, padding: OutI)(implicit b: Builder): OutD =
    new Complex1FFTStageImpl().connect(in = in, size = size, padding = padding)
}

/** Complex inverse Short Time Fourier Transform.
  * The is the counter-part to `Complex1FFT`.
  */
object Complex1IFFT {
  def apply(in: OutD, size: OutI, padding: OutI)(implicit b: Builder): OutD =
    new Complex1IFFTStageImpl().connect(in = in, size = size, padding = padding)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy