OpenShot Audio Library | OpenShotAudio: juce::dsp::FFT Class Reference

OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::dsp::FFT Class Reference

`#include <juce_FFT.h>`

## Public Member Functions
| FFT (int order)
| ~FFT ()
void | perform (const Complex< float > *input, Complex< float > *output, bool inverse) const noexcept
void | performRealOnlyForwardTransform (float *inputOutputData, bool dontCalculateNegativeFrequencies=false) const noexcept
void | performRealOnlyInverseTransform (float *inputOutputData) const noexcept
void | performFrequencyOnlyForwardTransform (float *inputOutputData) const noexcept
int | getSize () const noexcept

## Detailed Description

Performs a fast fourier transform.

This is only a simple low-footprint implementation and isn't tuned for speed - it may be useful for simple applications where one of the more complex FFT libraries would be overkill. (But in the future it may end up becoming optimised of course...)

The FFT class itself contains lookup tables, so there's some overhead in creating one, you should create and cache an FFT object for each size/direction of transform that you need, and re-use them to perform the actual operation.

Definition at line 45 of file juce_FFT.h.

## Constructor & Destructor Documentation

## ◆ FFT()

juce::dsp::FFT::FFT | ( | int | order | ) |

Initialises an object for performing forward and inverse FFT with the given size. The number of points the FFT will operate on will be 2 ^ order.

Definition at line 809 of file juce_FFT.cpp.

## ◆ ~FFT()

juce::dsp::FFT::~FFT | ( |  | ) |

Destructor.

Definition at line 815 of file juce_FFT.cpp.

## Member Function Documentation

## ◆ getSize()

int juce::dsp::FFT::getSize | ( |  | ) | const
| inlinenoexcept

Returns the number of data points that this FFT was created to work with.

Definition at line 101 of file juce_FFT.h.

## ◆ perform()

void juce::dsp::FFT::perform | ( | const Complex< float > * | input,
|  | Complex< float > * | output,
|  | bool | inverse
| ) |  | const
| noexcept

Performs an out-of-place FFT, either forward or inverse. The arrays must contain at least getSize() elements.

Definition at line 817 of file juce_FFT.cpp.

## ◆ performFrequencyOnlyForwardTransform()

void juce::dsp::FFT::performFrequencyOnlyForwardTransform | ( | float * | inputOutputData | ) | const
| noexcept

Takes an array and simply transforms it to the magnitude frequency response spectrum. This may be handy for things like frequency displays or analysis. The size of the array passed in must be 2 * getSize().

Definition at line 835 of file juce_FFT.cpp.

## ◆ performRealOnlyForwardTransform()

void juce::dsp::FFT::performRealOnlyForwardTransform | ( | float * | inputOutputData,
|  | bool | dontCalculateNegativeFrequencies = `false`
| ) |  | const
| noexcept

Performs an in-place forward transform on a block of real data.

As the coefficients of the negative frequencies (frequencies higher than N/2 or pi) are the complex conjugate of their positive counterparts, it may not be necessary to calculate them for your particular application. You can use dontCalculateNegativeFrequencies to let the FFT engine know that you do not plan on using them. Note that this is only a hint: some FFT engines (currently only the Fallback engine), will still calculate the negative frequencies even if dontCalculateNegativeFrequencies is true.

The size of the array passed in must be 2 * getSize(), and the first half should contain your raw input sample data. On return, if dontCalculateNegativeFrequencies is false, the array will contain size complex real + imaginary parts data interleaved. If dontCalculateNegativeFrequencies is true, the array will contain at least (size / 2) + 1 complex numbers. Both outputs can be passed to performRealOnlyInverseTransform() in order to convert it back to reals.

Definition at line 823 of file juce_FFT.cpp.

## ◆ performRealOnlyInverseTransform()

void juce::dsp::FFT::performRealOnlyInverseTransform | ( | float * | inputOutputData | ) | const
| noexcept

Performs a reverse operation to data created in performRealOnlyForwardTransform().

Although performRealOnlyInverseTransform will only use the first ((size / 2) + 1) complex numbers, the size of the array passed in must still be 2 * getSize(), as some FFT engines require the extra space for the calculation. On return, the first half of the array will contain the reconstituted samples.

Definition at line 829 of file juce_FFT.cpp.

The documentation for this class was generated from the following files:

- juce_FFT.h
- juce_FFT.cpp