libvisual  0.5.0
Public Member Functions | Static Public Member Functions | List of all members
LV::DFT Class Reference

Computes a Discrete Fourier Transform. More...

#include <libvisual/lv_fourier.h>

Public Member Functions

 DFT (unsigned int samples_out, unsigned int samples_in)
 Creates a DFT object used to calculate amplitude spectrums over audio data. More...
 
 DFT (DFT const &)=delete
 
 DFT (DFT &&rhs)
 Move constructor.
 
 ~DFT ()
 Destructor.
 
DFToperator= (DFT const &)=delete
 
DFToperator= (DFT &&rhs)
 Move assignment operator.
 
unsigned int get_spectrum_size () const
 Returns the output size of the DFT. More...
 
void perform (float *output, float const *input)
 Performs a DFT over a set of input samples. More...
 

Static Public Member Functions

static void log_scale (float *output, float const *input, unsigned int size)
 Logarithmically scales an amplitude spectrum. More...
 
static void log_scale_standard (float *output, float const *input, unsigned int size)
 
static void log_scale_custom (float *output, float const *input, unsigned int size, float log_scale_divisor)
 

Detailed Description

Computes a Discrete Fourier Transform.

Definition at line 41 of file lv_fourier.h.

Constructor & Destructor Documentation

LV::DFT::DFT ( unsigned int  samples_out,
unsigned int  samples_in 
)

Creates a DFT object used to calculate amplitude spectrums over audio data.

Note
For optimal performance, use a power-of-2 spectrum size. The current implementation does not use the Fast Fourier Transform for non powers of 2.
If samples_in is smaller than 2 * samples_out, the input will be padded with zeroes.
Parameters
samples_inThe number of samples provided to every call to DFT::perform() as input.
samples_outSize of output spectrum (number of output samples).

Definition at line 203 of file lv_fourier.cpp.

Member Function Documentation

unsigned int LV::DFT::get_spectrum_size ( ) const

Returns the output size of the DFT.

Returns
Output size
void LV::DFT::log_scale ( float *  output,
float const *  input,
unsigned int  size 
)
static

Logarithmically scales an amplitude spectrum.

Note
Scaled values are guaranteed to be in [0.0, 1.0].
Parameters
outputArray of output samples
inputArray of input samples with values in [0.0, 1.0]
sizeArray size.

Definition at line 245 of file lv_fourier.cpp.

void LV::DFT::perform ( float *  output,
float const *  input 
)

Performs a DFT over a set of input samples.

Parameters
outputArray of output samples
inputArray of input samples with values in [-1.0, 1.0]

Definition at line 226 of file lv_fourier.cpp.

Referenced by LV::Audio::get_spectrum_for_sample().


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