-
Notifications
You must be signed in to change notification settings - Fork 172
- The object name is now capitalized and the constructor requires a floating-point data type, e.g. "ArduinoFFT" instead of "arduinoFFT".
- All function names are camelCase case now (start with lower-case character), e.g. "windowing()" instead of "Windowing()".
The number of samples MUST ALWAYS be a power of 2. Any other value will produce an infinite loop during the computing phase. Acceptable values are: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384.
There is a bug causing an overflow when samples==2048 or samples==4096 and the dominant frequency is not properly detected. Don't use those values until further notice.
Simplest constructor possible. Returns an arduinoFFT object that will operate on arguments of the type T where Tis either floator double.
This constructor was kept for backwards compatibility with and using it demands using the functions that at the very least receive the following parameters:
- Pointers to the data arrays of type
T - Number of samples
- Sampling frequency
ArduinoFFT<T>(T *vReal, T *vImag, uint_fast16_t samples, T samplingFrequency, bool windowingFactors)
Returns an arduinoFFT object that will operate on arguments of the type T where Tis either floator double.
-
vRealPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
vImagPointer to a data array of sizesamplesand typeTwhere the imaginary part of the data is stored and will be processed. -
samplesSize of the data array in number of elements. -
samplingFrequencyfloating point value of typeTindicating the frequency in Hz at which the data sampling was performed. -
windowingFactors(optional) (Since v2.0) Boolean factor to enable internal storage of the windowing factors, streamlining subsequent windowing operations. Defaults to false.
Processes the computed data and calculates magnitudes from complex numbers. The output will overwrite the first half of the integer data array.
Processes the computed data and calculates magnitudes from complex numbers. The output will overwrite the first half of the integer data array.
-
vRealPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
vImagPointer to a data array of sizesamplesand typeTwhere the imaginary part of the data is stored and will be processed. -
samplesSize of the data array in number of elements.
Performs the Fast Fourier Transformation using the Cooley–Tukey algorithm.
-
dirDirection on which to perform the transformation. Accepted values are FFTDirection::Forward or FFTDirection::Reverse
Performs the Fast Fourier Transformation using the Cooley–Tukey algorithm.
-
vRealPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
vImagPointer to a data array of sizesamplesand typeTwhere the imaginary part of the data is stored and will be processed. -
samplesSize of the data array in number of elements. -
dirDirection on which to perform the transformation. Accepted values are FFTDirection::Forward or FFTDirection::Reverse
Performs the Fast Fourier Transformation using the Cooley–Tukey algorithm.
-
vRealPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
vImagPointer to a data array of sizesamplesand typeTwhere the imaginary part of the data is stored and will be processed. -
samplesSize of the data array in number of elements. -
powerLog base 2 ofsamples. -
dirDirection on which to perform the transformation. Accepted values are FFTDirection::Forward or FFTDirection::Reverse
Offsets the sampled signal so that it is centered around the X-axis of a plot, removing any DC offset that could have been present during sampling.
Offsets the sampled signal so that it is centered around the X-axis of a plot, removing any DC offset that could have been present during sampling. ** This is the version that must be used when using the simple constructor. **
-
vDataPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
samplesSize of the data array in number of elements.
Returns an estimation of the dominant frequency according to the interpolation of the biggest peak found on the magnitude array.
Computes an estimation of the dominant frequency through interpolation of the magnitude array and its magnitude in arbitrary units.
-
frequencyPointer to a variable of typeTwhere the interpolated frequency value will be stored. -
magnitudePointer to a variable of typeTwhere the magnitude in arbitrary units will be stored.
Returns an estimation of the dominant frequency according to the interpolation of the biggest peak found on the magnitude array.
-
vDataPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
samplesSize of the data array in number of elements. -
samplingFrequencyfloating point value of typeTindicating the frequency in Hz at which the data sampling was performed.
Computes an estimation of the dominant frequency through interpolation of the magnitude array and its magnitude in arbitrary units.
-
vDataPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
samplesSize of the data array in number of elements. -
samplingFrequencyfloating point value of typeTindicating the frequency in Hz at which the data sampling was performed. -
frequencyPointer to a variable of typeTwhere the interpolated frequency value will be stored. -
magnitudePointer to a variable of typeTwhere the magnitude in arbitrary units will be stored.
Returns an estimation of the dominant frequency according to interpolation through the parabola equation of the biggest peak found on the magnitude array.
Computes the interpolated frequency value of the biggest peak found on the magnitude array and its magnitude in arbitrary units using the parabola equation.
-
frequencyPointer to a variable of typeTwhere the interpolated frequency value will be stored. -
magnitudePointer to a variable of typeTwhere the magnitude in arbitrary units will be stored.
Returns an estimation of the dominant frequency according to interpolation through the parabola equation of the biggest peak found on the magnitude array.
-
vDataPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
samplesSize of the data array in number of elements. -
samplingFrequencyfloating point value of typeTindicating the frequency in Hz at which the data sampling was performed.
void majorPeakParabola(T *vData, uint_fast16_t samples, T samplingFrequency, T *frequency, T *magnitude)
Computes the interpolated frequency value of the biggest peak found on the magnitude array and its magnitude in arbitrary units using the parabola equation.
-
vDataPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
samplesSize of the data array in number of elements. -
samplingFrequencyfloating point value of typeTindicating the frequency in Hz at which the data sampling was performed. -
frequencyPointer to a variable of typeTwhere the interpolated frequency value will be stored. -
magnitudePointer to a variable of typeTwhere the magnitude in arbitrary units will be stored.
Performs a windowing operation on the data to give more or less weight to different data sections.
-
windowTypeWhich windowing operation should be performed on the data. Accepted values are:- FFTWindow::Rectangle
- FFTWindow::Hamming
- FFTWindow::Hann
- FFTWindow::Triangle
- FFTWindow::Nuttall
- FFTWindow::Blackman
- FFTWindow::Blackman_Nuttall
- FFTWindow::Blackman_Harris
- FFTWindow::Flat_top
- FFTWindow::Welch
-
dirDirection on which to perform the windowing operation, aka apply/remove windowing factors. Accepted values are:- FFTDirection::Forward Apply the windowing.
- FFTDirection::Reverse Remove the windowing.
-
withCompensation(optional) (Since v2.0) Boolean value regarding the use of compensation factors to correct how the signal is modified during windowing. Defaults to false.
void windowing(T *vData, uint_fast16_t samples, FFTWindow windowType, FFTDirection dir, T *windowingFactors, bool withCompensation)
Performs a windowing operation on the data to give more or less weight to different data sections.
-
windowTypeWhich windowing operation should be performed on the data. Accepted values are:- FFTWindow::Rectangle
- FFTWindow::Hamming
- FFTWindow::Hann
- FFTWindow::Triangle
- FFTWindow::Nuttall
- FFTWindow::Blackman
- FFTWindow::Blackman_Nuttall
- FFTWindow::Blackman_Harris
- FFTWindow::Flat_top
- FFTWindow::Welch
-
dirDirection on which to perform the windowing operation, aka apply/remove windowing factors. Accepted values are:- FFTDirection::Forward Apply the windowing.
- FFTDirection::Reverse Remove the windowing.
-
withCompensation(optional) (Since v2.0) Boolean value regarding the use of compensation factors to correct how the signal is modified during windowing. Defaults to false.
See Windowing for more information regarding the window types.
Returns the current revision of the arduinoFFT library with the format 0xMn where M is the mayor version number and n is the minor version number. For example 0x15 corresponds to version 1.5.
Replaces the internal data array pointers with new pointers.
-
vRealPointer to a data array of sizesamplesand typeTwhere the integer part of the data is stored and will be processed. -
vImagPointer to a data array of sizesamplesand typeTwhere the imaginary part of the data is stored and will be processed. -
samples(optional) Size of the data array in number of elements. Only necessary if the number of elements has changed since object creation.