37#include <avr/pgmspace.h>
50#ifndef FFT_SQRT_APPROXIMATION
52 #define sqrt_internal sqrt
56#define FFT_LIB_REV 0x20
61 ArduinoFFT(T *vReal, T *vImag, uint_fast16_t samples, T samplingFrequency,
62 bool windowingFactors =
false);
66 void complexToMagnitude(
void)
const;
67 void complexToMagnitude(T *vReal, T *vImag, uint_fast16_t samples)
const;
69 void compute(FFTDirection dir)
const;
70 void compute(T *vReal, T *vImag, uint_fast16_t samples,
71 FFTDirection dir)
const;
72 void compute(T *vReal, T *vImag, uint_fast16_t samples, uint_fast8_t power,
73 FFTDirection dir)
const;
75 void dcRemoval(
void)
const;
76 void dcRemoval(T *vData, uint_fast16_t samples)
const;
78 T majorPeak(
void)
const;
79 void majorPeak(T *f, T *v)
const;
80 T majorPeak(T *vData, uint_fast16_t samples, T samplingFrequency)
const;
81 void majorPeak(T *vData, uint_fast16_t samples, T samplingFrequency,
82 T *frequency, T *magnitude)
const;
84 T majorPeakParabola(
void)
const;
85 void majorPeakParabola(T *frequency, T *magnitude)
const;
86 T majorPeakParabola(T *vData, uint_fast16_t samples,
87 T samplingFrequency)
const;
88 void majorPeakParabola(T *vData, uint_fast16_t samples, T samplingFrequency,
89 T *frequency, T *magnitude)
const;
91 uint8_t revision(
void);
93 void setArrays(T *vReal, T *vImag, uint_fast16_t samples = 0);
95 void windowing(FFTWindow windowType, FFTDirection dir,
96 bool withCompensation =
false);
97 void windowing(T *vData, uint_fast16_t samples, FFTWindow windowType,
98 FFTDirection dir, T *windowingFactors =
nullptr,
99 bool withCompensation =
false);
103 static const T _WindowCompensationFactors[11];
104#ifdef FFT_SPEED_OVER_PRECISION
105 T _oneOverSamples = 0.0;
107 bool _isPrecompiled =
false;
108 bool _precompiledWithCompensation =
false;
109 uint_fast8_t _power = 0;
110 T *_precompiledWindowingFactors =
nullptr;
111 uint_fast16_t _samples;
112 T _samplingFrequency;
115 FFTWindow _windowFunction;
117 uint_fast8_t exponent(uint_fast16_t value)
const;
118 void findMaxY(T *vData, uint_fast16_t length, T *maxY,
119 uint_fast16_t *index)
const;
120 void parabola(T x1, T y1, T x2, T y2, T x3, T y3, T *a, T *b, T *c)
const;
121 void swap(T *a, T *b)
const;
123#ifdef FFT_SQRT_APPROXIMATION
124 float sqrt_internal(
float x)
const;
125 double sqrt_internal(
double x)
const;
129#if defined(__AVR__) && defined(USE_AVR_PROGMEM)
130static const float _c1[] PROGMEM = {
131 0.0000000000, 0.7071067812, 0.9238795325, 0.9807852804, 0.9951847267,
132 0.9987954562, 0.9996988187, 0.9999247018, 0.9999811753, 0.9999952938,
133 0.9999988235, 0.9999997059, 0.9999999265, 0.9999999816, 0.9999999954,
134 0.9999999989, 0.9999999997};
135static const float _c2[] PROGMEM = {
136 1.0000000000, 0.7071067812, 0.3826834324, 0.1950903220, 0.0980171403,
137 0.0490676743, 0.0245412285, 0.0122715383, 0.0061358846, 0.0030679568,
138 0.0015339802, 0.0007669903, 0.0003834952, 0.0001917476, 0.0000958738,
139 0.0000479369, 0.0000239684};
Definition: arduinoFFT.h:58