Skip to content

Signalsmith-Audio/fft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Signalsmith FFT

A small and (reasonably) performant C++11 FFT implementation.

Under development, so things might be a little untidy at the moment, but the API's stable and the tests should build/pass.

#include "signalsmith-fft.h"

signalsmith::FFT<double> fft(size);

speed comparison graph

Setting the size

fft.setSize(1024);

It is faster for certain sizes (powers of 2, 3 and 5), and it's strongly recommended that you use these. For convenience there are two methods for finding fast sizes above and below a limit:

actualSize = fft.setSizeMinimum(1025); // sets (and returns) a fast size >= 1025

actualSize = fft.setSizeMaximum(1025); // sets (and returns) a fast size <= 1025

Forward/reverse FFT

fft.fft(complexTime, complexSpectrum);

fft.ifft(complexSpectrum, complexTime);

These methods are templated, and accept any iterator or container holding a std::complex. This could be a pointer (e.g. std::complex<double> *), or a std::vector, or whatever.

Real FFT

signalsmith::RealFFT<double> fft(size);

fft.fft(realTime, complexSpectrum);
fft.ifft(complexSpectrum, realTime);

The size must be even. The complex spectrum is half the size - e.g. 256 real inputs produce 128 complex outputs.

Since the 0 and Nyquist frequencies are both real, these are packed into the real/imaginary parts of index 0.

About

A small and (reasonably) fast FFT library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published