#include <fft.hh>
Compute an Fast Fourier Transform.
The Module can be used to compute a Fast Fourier Transform on its input. The resulting transform is available as a vector of fftw_complex numbers. See the documentation for the library fftw3. The data can also be printed to stdout using the ascii(), html(), or json() methods. See the example in examples/FFT for a demonstration.
[input] | signal The input signal |
[output] | ready 0 when the FFT is still collecting data, and 1 otherwise |
Public Member Functions | |
FFT (int size) | |
void | init () |
void | update () |
void | ascii () |
Print the FFT data to stdout. | |
void | html () |
Print a nice plot of the FFT to stdout that can be viewed with a web browser. | |
std::string | json () |
Print the FFT data as a json object to stdout. | |
fftw_complex * | get () |
![]() | |
virtual void | init ()=0 |
virtual void | update ()=0 |
int | add_input (string name) |
int | add_output (string name) |
int | get_input_index (string name) const |
string | get_input_name (int index) const |
string | get_output_name (int index) const |
int | get_output_index (string name) const |
void | set_input (string name, double value) |
void | set_input (int index, double value) |
double | get_input (int index) const |
double | get_input (string name) const |
double | get_output (string name) const |
double | get_output (int index) const |
void | set_output (int index, double value) |
void | copy_inputs (const Module &source) |
void | copy_outputs (Module &destination) const |
void | configure (std::vector< std::tuple< string, double > > assignments) |
int | num_inputs () const |
int | num_outputs () const |
void | emit (Event e) |
void | set_ts (double s) |
double | get_ts () |
yase::FFT::FFT | ( | int | size | ) |
Construct an FFT module with the given size.
size | The number of samples to transform |
fftw_complex * yase::FFT::get | ( | ) |
|
virtual |
This method should be overridden by derived classes. It will usually be called once, after all modules and connections objects have been added to a synthesizer, but before the synthesizer starts running.
Implements yase::Module.
|
virtual |
This method should be overridden by derived classes. It will be called repeatedly by a synthesizer at a frequency determined by SAMPLE_RATE.
Implements yase::Module.