Coder Social home page Coder Social logo

arduinofft's People

Contributors

bjorntheprogrammer avatar blaz-r avatar dantali0n avatar drzony avatar edgar-bonet avatar fintasticman avatar ivankravets avatar kosme avatar marscaper avatar per1234 avatar pranabendra avatar slav-at-attachix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinofft's Issues

Memory limit exceeds for samples = 256 in Arduino Uno

When using samples = 256, the Global Variables use more than 2048 bytes which is not allowed in Arduino Uno (ATmega328p).
I want to calculate DFT of only real signals (e.g. ADC input). Could it be possible to optimize the code for only real signals?
I tried to do it myself but came to the conclusion that the code was already immensely optimized for space.

Possible additional method

Also a method void MaxPeak(uint16_t start_idx, double *f, double *v) is very useful - e.g. when you want to get the max peak not the major peak - and also filter the first n bins e.g. 👍

.....
uint16_t IndexOfMaxY = 0;
for (uint16_t i = start_idx; i < ((this->_samples >> 1) + 1); i++) {
if (this->_vReal[i] > maxY) {
maxY = this->_vReal[i];
IndexOfMaxY = i;
}
}

Submission of ratio table for windowing function

Thanks for your work. I see that ratio table is in your todo list.

I calculated the table for my own need. Here It is...

float WindowCompensationFactor[10] =
{
    2,            /* rectangle (Box car) */
    1.8549343278*2, /* hamming */
    1.8554726898*2, /* hann */
    2.0039186079*2, /* triangle (Bartlett) */
    2.8163172034*2, /* nuttall */
    2.367347436*2,  /* blackman */
    2.7557840395*2, /* blackman nuttall */
    2.7929062517*2, /* blackman harris*/
    3.5659039231*2, /* flat top */
    1.5029392863*2  /* welch */
};

Compensation seems to be fine in my project... :)
Simulation screenshot

Hope It helps,
Sebastien.

Update README.md to clarify deprecated methods.

Hello.

It's difficult to know which method is recommended by reading API in README.md.
How about changing to following description?

### API

* **arduinoFFT**(double *vReal, double *vImag, uint16_t samples, double samplingFrequency);
Constructor
* **~arduinoFFT**(void);
Destructor
* **ComplexToMagnitude**();
* **Compute**(uint8_t dir);
Calcuates the Fast Fourier Transform.
* **DCRemoval**();
Removes the DC component from the sample data.
* **MajorPeak**();
Looks for and returns the frequency of the biggest spike in the analyzed signal.
* **Revision**(void);
Returns the library revision.
* **Windowing**(uint8_t windowType, uint8_t dir);
Performs a windowing function on the values array. The possible windowing options are:
    * FFT_WIN_TYP_RECTANGLE
    * FFT_WIN_TYP_HAMMING
    * FFT_WIN_TYP_HANN
    * FFT_WIN_TYP_TRIANGLE
    * FFT_WIN_TYP_NUTTALL
    * FFT_WIN_TYP_BLACKMAN
    * FFT_WIN_TYP_BLACKMAN_NUTTALL
    * FFT_WIN_TYP_BLACKMAN_HARRIS
    * FFT_WIN_TYP_FLT_TOP
    * FFT_WIN_TYP_WELCH

Following methods are deprecated and may be removed on future revisions.
* **arduinoFFT**(void);
* **ComplexToMagnitude**(double *vReal, double *vImag, uint16_t samples);
* **Compute**(double *vReal, double *vImag, uint16_t samples, uint8_t dir);
* **Compute**(double *vReal, double *vImag, uint16_t samples, uint8_t power, uint8_t dir);
* **DCRemoval**(double *vData, uint16_t samples);
* **MajorPeak**(double *vD, uint16_t samples, double samplingFrequency);
* **Windowing**(double *vData, uint16_t samples, uint8_t windowType, uint8_t dir);
* **Exponent**(uint16_t value);

samples could not more than 128 ?

Hi,

I would like to ask about the number of samples - why the number of samples can't be greater than 128 e.g. 256, 512. I am using redbear duo / particle spark and it does not return error - however, it is not working and the system were halted. Looking for your help. thanks..

A very basic problem

Hey
I'm very new to all this electronics stuff, im not as technically inclined as i though it seems (compared to all o' y'all ;D ) i dont understand how the hell i add the file to my arduino installation, that will make the error message go away, the one that contains the information that my computer cant find in its library.

you know the one that will stop this error:

/Users/zachos/Documents/Arduino/whistler/whistler.ino:1:68: fatal error: arduinoFFT.h: No such file or directory
#include "arduinoFFT.h" // From https://github.com/kosme/arduinoFFT
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

btw im doing this on a macbook (don't judge me) so it may be different on my end than on yours...?
ive tried to open the folder the error refers to (/Users/zachos/Documents/Arduino/whistler) and just dropping the the README.md.webloc (https://github.com/kosme/arduinoFFT/blob/master/README.md) in there (ive also tried the version 1.4(d8c22a8)), but it constantluy judt shows up as a link to the webpage, i think that might have something to do with whythe arduino cant use it even though it is there, but how do i get it in there so it can use it?

I'm at my wits end, i dont really have anyone else to turn to for help right now so will you please help me?

use delayMicroseconds() in examples instead of less accurate empty active wait loop.

instead of doing
microseconds = micros(); for(int i=0; i<samples; i++) { vReal[i] = analogRead(CHANNEL); vImag[i] = 0; while(micros() - microseconds < sampling_period_us){ //empty loop } microseconds += sampling_period_us; }

it's easier and more arduino like to do

for(int i=0; i<samples; i++) { vReal[i] = analogRead(CHANNEL); vImag[i] = 0; delayMicroseconds(sampling_period_us); }

delayMicroseconds() will perform likely more accurately than your active wait esp. if the sampling period is small.

Wrong peak frequencies (at sampling rates > ~10000 Hz)

I observed some confusing peak values doing FFT with your lib. After researching a couple of
evenings and debugging without finding a solution, i would like to discuss that here. Maybe I
did something wrong or misinterpreted something.

Problem: The calculated peaks changes with higher sampling rate (starting from ~10 kHz).

Up to a sampling rate (SF) of about 10 kHz the returned peak frequency matches my
signal generators frequencies (537Hz and 2100Hz) more or less excactly. For higher SF
(10k+), the returned peak is more and more off. That offset increases with an increasing SR (in a linear way). Changing number of samples didn't change anything (seems not relevant). Here are some measured values:

		Sig. 1		Sig. 2
SF (Hz)		537 Hz		2100 Hz
-------------------------------------------
 5000		 537		 2100
10000		 537		 2100
15000		 791		 3105
20000		1055		 4141
25000		1318		 5176
30000		1582		 6211
40000		2109		 8281
50000		2657		10352

Quite interresting 🧐. At least, there seems to be a pattern. So I could find a good correction factor for sampling rates above 10160Hz:

	Frequency[Real Peak] = Frequency[Peak calculated by FFT] / SF * 10160

It's good for a workaround, but no real solution nor explaination for my wrong fft-peaks.

So... Any idea why this "offset" happens or how could i correct that unexpected behaviour?

--
Btw#1: Generating vReal (as im your examples sketches) didnt show that error (frequency matches FTT_Peak):

double cycles = (((SAMPLES-1) * frequency) / SAMPLING_FREQUENCY);
	for (uint16_t i = 0; i < SAMPLES; i++) {
		vReal[i] = int8_t((AMPLITUDE * (sin((i * (twoPi * cycles)) / SAMPLES))) / 2.0);
		vImag[i] = 0.0;
	}

--
The signal generator i used for testing is an phone app (f Generator), that is connected
via audio jack (Audio-GND to ESP-Gnd, L/R-signal routes via capacitor and a voltage divider
(2x10kOhm) to Pin.A0 of an standard NodeMcu/ESP32. Tested also with a direct connection from head phone jack -> A0) and a microphone. Same offset here...

Request to keep older features to reduce memory footprint

As someone recently using this library, I have noticed that the methods supporting pointers to the data to be processed are deprecated, and possibly soon to be removed. I ask that this feature be kept, as passing the pointers to the data in the constructor makes it impossible to allocate and free the rather large memory usage of the library when it's not in use.

Perhaps this could be simplified by making the simplified version of the methods call the existing parameterized functions with the internal pointers and values as arguments?

At minimum, the ability to deallocate the imaginary portion of the data (since most results are returned in the real portion of the arrays) would be helpful, but I have personally found it more efficient to copy the results to a smaller type and free both arrays.

One more thing I'd like would be a filter to normalize all the data to a certain range (so outputs cannot go higher than 100, for example. I'm not sure how this could work since the volume is unknown and I don't see the highest result always being 100 as practical), and perhaps apply a minimum amplitude to the results below which the bins are zero so that visualizers (for instance) don't have spurious noise. I'm not certain if this is already a feature...?

Example F02

hi
i was trying to use the library but i couldnt understand what the output was for
i want to use the ADC on the esp8266 to take the FFT of the incoming signal on the ADC values, is this the correct library to use and if yes where should i provide the values from the ADC.

i felt like the amplitude variable could store the values incoming from the ADC but i'm not so sure, any help is appreciated :-)

Index error

Hello,
Thanks for this great library. From the readings I get I am quite sure there is an index error in the computing.

The signal is 100 Hz (certain). Here are magnitude values:

92.285156Hz 419.9703
96.679687Hz 604.0108
101.074219Hz 416.5447
105.468750Hz 399.8800

Tuner and devices

Hi, im starting with arduino, in the class i have to make a proyect for the semester, i have all the basic theory of how to connect the parts of the arduino, but for example, my teacher told me that i cant use a normal arduino microphone to analyce the sound specter and the real part that i need is a sensor only, so i wanted to know what actually i need for the tuner , and what i will need because i really wanted to make it work by itself.

Doubt

@kosme Not able to understand what are the meaning of the 2 plots, red and blue, in the serial plotter. Using FFT_03 because I am providing external input from Sparkfun sound detector. Please help!

compability of the examples with the ESP8266

To get the examples working on the ESP 8266 minor changes are necessary to prevent the soft wdt reset.

  1. in the loop replace while(1):
    with
    while(1) {
    delay(0);
    }

  2. add to the printvector function delay(0);

Improve MajorPeak with parabola

I would like to submit you an improvement in frequency estimation by using a parabola estimation using three points...
Red Parabola

It improves frequency estimation but also amplitude/magnitude estimation. Here is my project with the current MajorPeak() code...
Capture d’écran 2020-01-21 à 21 14 08

And now with my parabola estimation...
Capture d’écran 2020-01-21 à 21 13 36

Here is my code. Feel free to use It... :)

double arduinoFFT::MajorPeakParabola()
{
    double maxY = 0;
    uint16_t IndexOfMaxY = 0;
    //If sampling_frequency = 2 * max_frequency in signal,
    //value would be stored at position samples/2
    for (uint16_t i = 1; i < ((this->_samples >> 1) + 1); i++)
    {
        if ((this->_vReal[i-1] < this->_vReal[i]) && (this->_vReal[i] > this->_vReal[i+1]))
        {
            if (this->_vReal[i] > maxY)
            {
                maxY = this->_vReal[i];
                IndexOfMaxY = i;
            }
        }
    }
    
    double freq = 0;
    if( IndexOfMaxY>0 )
    {
        // Assume the three points to be on a parabola
        double a,b,c;
        Parabola
        (IndexOfMaxY-1,this->_vReal[IndexOfMaxY-1],
         IndexOfMaxY  ,this->_vReal[IndexOfMaxY  ],
         IndexOfMaxY+1,this->_vReal[IndexOfMaxY+1],
         &a,&b,&c);
        
        // Peak is at the middle of the parabola
        double x = -b/(2*a);

        // And magnitude is at the extrema of the parabola if you want It...
        // double y = a*x*x+b*x+c;  
              
        // Convert to frequency
        freq = (x  * this->_samplingFrequency) / (this->_samples);
    }
    
    return freq;
}

void arduinoFFT::Parabola(double x1, double y1, double x2, double y2, double x3, double y3, double *a, double *b, double *c)
{
    double reversed_denom = 1/((x1 - x2) * (x1 - x3) * (x2 - x3));
    
    *a = (x3 * (y2 - y1) + x2 * (y1 - y3) + x1 * (y3 - y2)) * reversed_denom;
    *b = (x3*x3 * (y1 - y2) + x2*x2 * (y3 - y1) + x1*x1 * (y2 - y3)) * reversed_denom;
    *c = (x2 * x3 * (x2 - x3) * y1 + x3 * x1 * (x3 - x1) * y2 + x1 * x2 * (x1 - x2) * y3) *reversed_denom;
}

Relation between output and dB

I've been developing a project with help of this library. It consists in an arduino board capable of identifying sound pollution. The code I'm using was found in here and was adapted to my needs. The code is the following:

#include <arduinoFFT.h>
 
#define SAMPLES 128             //Must be a power of 2
#define SAMPLING_FREQUENCY 10000 //Hz, must be less than 10000 due to ADC
 
arduinoFFT FFT = arduinoFFT();
 
unsigned int sampling_period_us;
unsigned long microseconds;
 
double vReal[SAMPLES];
double vImag[SAMPLES];
 
void setup() {
    Serial.begin(115200);
 
    sampling_period_us = round(1000000*(1.0/SAMPLING_FREQUENCY));
}
 
void loop() {
   
    /*SAMPLING*/
    for(int i=0; i<SAMPLES; i++)
    {
        microseconds = micros();    //Overflows after around 70 minutes!
     
        vReal[i] = analogRead(36);
        vImag[i] = 0;
     
        while(micros() < (microseconds + sampling_period_us)){
        }
    }
 
    /*FFT*/
    FFT.Windowing(vReal, SAMPLES, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
    FFT.Compute(vReal, vImag, SAMPLES, FFT_FORWARD);
    FFT.ComplexToMagnitude(vReal, vImag, SAMPLES);
    double peak = FFT.MajorPeak(vReal, SAMPLES, SAMPLING_FREQUENCY);
 
    /*PRINT RESULTS*/
    //Serial.println(peak);     //Print out what frequency is the most dominant.
 
    for(int i=0; i<(SAMPLES/2); i++)
    {
        /*View all these three lines in serial terminal to see which frequencies has which amplitudes*/
         
        //Serial.print((i * 1.0 * SAMPLING_FREQUENCY) / SAMPLES, 1);
        //Serial.print(" ");
        Serial.println(vReal[i], 1);    //View only this line in serial plotter to visualize the bins
    }
 
    delay(1000);  //Repeat the process every second OR:
    //while(1);       //Run code once
}

I've been trying for a while now to figure out a relation between the values provided by the program and a decibel value.

Any ideas?

Does it work on ESP8266?

ESP8266 has a much faster ADC and should be able to this job much better. Will it run properly on ESP8266 using Arduino compiler?

Overflow (ovf) encountered

I'm using this library to calculate FFT of real signals from ADC on ESP8266. The magnitude values of the FFT continue to increase in size and within a second they reach 'ovf'. Could you please look into it or at least guide me some direction to resolve this?

This is my configuration:

I've attached the sketch and the output.

Sketch:

// Expose Espressif SDK functionality - wrapped in ifdef so that it still
// compiles on other platforms
#ifdef ESP8266
    extern "C" {
        #include "user_interface.h"
    }
#endif

#include "arduinoFFT.h"


ADC_MODE(ADC_TOUT);

arduinoFFT FFT = arduinoFFT(); /* Create FFT object */

#define num_samples 128     // Number of samples collected by the ADC in one round
uint16_t adc_addr[num_samples]; // point to the address of ADC continuously fast sampling output
uint16_t adc_num = num_samples; // sampling number of ADC continuously fast sampling, range [1, 65535]
uint8_t adc_clk_div = 16; // ADC working clock = 80M/adc_clk_div, range [8, 32], the recommended value is 8

/*
N = Number of samples on which processing will be done in each round
These are the input and output vectors
Input vectors receive computed results from FFT
*/
#define N 32    // Ideally for the bins to be separated by ~25 Hz, N should be 512 for samplingFrequency ~= 25 kHz
double vReal[N];
double vImag[N];

float samplingFrequency = 10000.0;

unsigned long start = 0;
uint16_t samplingDuration = 1;


#define SCL_INDEX 0x00
#define SCL_TIME 0x01
#define SCL_FREQUENCY 0x02
#define SCL_PLOT 0x03


void setup() {
    // put your setup code here, to run once:
    Serial.begin(115200);

    for (int i=0; i<N; i++) {
        vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows
    }
}

void loop() {
    // put your main code here, to run repeatedly:
    #ifdef ESP8266
        wifi_set_opmode(NULL_MODE);
        system_soft_wdt_stop();
        ets_intr_lock( ); //close interrupt
        noInterrupts();

        start = micros();

        /**
         * The following snippet is used for reading ADC values
         * one value at a time using system_adc_read()
         */
        // for (int i=0; i<N; i++) {
        //     vReal[i] = system_adc_read();
        // }

        /**
         * system_adc_read_fast() is used to read N ADC values in one go.
         * This increases the sampling frequency by a factor of over 10
         */
        system_adc_read_fast(adc_addr, adc_num, adc_clk_div);

        samplingDuration = micros() - start;

        interrupts();
        ets_intr_unlock(); //open interrupt
        system_soft_wdt_restart();

        samplingFrequency = N * 1000000.0 / samplingDuration;

        /**
         * Downsample the input signal by averaging the input data
         * to reduce the sampling frequency by a factor of 4 in this case.
         * This is done to bring the sampling frequency close to 25 kHz
         * Maximum high frequency for human ear is assumed to be 12-13 kHz
         */
        averageRawADCValues(adc_addr, adc_num, vReal, N);

        /* Print the results of the simulated sampling according to time */
        Serial.println("Data:");
        PrintVector(vReal, N, SCL_TIME);


        // Weigh data
        FFT.Windowing(vReal, N, FFT_WIN_TYP_HAMMING, FFT_FORWARD);

        Serial.println("Weighed data:");
        PrintVector(vReal, N, SCL_TIME);


        // Compute FFT
        FFT.Compute(vReal, vImag, N, FFT_FORWARD);

        Serial.println("Computed Real values:");
        PrintVector(vReal, N, SCL_INDEX);
        Serial.println("Computed Imaginary values:");
        PrintVector(vImag, N, SCL_INDEX);


        // Compute magnitudes
        FFT.ComplexToMagnitude(vReal, vImag, N);

        Serial.println("Computed magnitudes:");
        PrintVector(vReal, (N >> 1), SCL_FREQUENCY);

    #endif
}

/**
 * Perform downsampling by taking average of 'n' number of consecutive samples after skipping 'n' samples each time
 * @param src_arr       [Source array]
 * @param src_arr_size  [Source array size]
 * @param dest_arr      [Destination array]
 * @param dest_arr_size [Destination array size]
 */
void averageRawADCValues(uint16_t src_arr[], uint16_t src_arr_size, double dest_arr[], uint16_t dest_arr_size)
{
    int sample_count = src_arr_size / dest_arr_size;

    if (sample_count < 1) {
        sample_count = 1;
    }

    for (uint16_t i=0; i<dest_arr_size; i++) {

        uint16_t local_lower_bound = i * sample_count;
        uint16_t local_upper_bound = local_lower_bound + sample_count;
        unsigned long local_sum = 0;

        for (uint16_t j=local_lower_bound; j<local_upper_bound; j++) {
            if (j < src_arr_size) {
                local_sum += src_arr[j];
            }
        }

        dest_arr[i] = (1.0 * local_sum) / sample_count;
    }
}


void PrintVector(double *vData, uint16_t bufferSize, uint8_t scaleType)
{
    for (uint16_t i = 0; i < bufferSize; i++)
    {
        double abscissa;
        /* Print abscissa value */
        switch (scaleType)
        {
            case SCL_INDEX:
                abscissa = (i * 1.0);
                break;
            case SCL_TIME:
                abscissa = ((i * 1.0) / samplingFrequency);
                break;
            case SCL_FREQUENCY:
                abscissa = ((i * 1.0 * samplingFrequency) / N);
                break;
        }
        Serial.print(abscissa, 6);
        if(scaleType==SCL_FREQUENCY)
            Serial.print("Hz");
        
        Serial.print(" ");
        Serial.println(vData[i], 4);
    }
    Serial.println();
}

Output (2 parts):

  • Part 1 - For the first few iterations
Data:
0.000000 258.5000
0.000037 259.0000
0.000074 258.5000
0.000111 258.7500
0.000148 259.0000
0.000185 259.0000
0.000222 259.0000
0.000259 259.0000
0.000296 259.0000
0.000333 259.0000
0.000370 259.0000
0.000407 259.0000
0.000444 258.7500
0.000481 259.0000
0.000518 258.7500
0.000555 259.0000
0.000592 258.7500
0.000629 258.2500
0.000666 258.5000
0.000703 258.2500
0.000740 258.2500
0.000777 258.0000
0.000814 258.0000
0.000851 258.2500
0.000888 258.5000
0.000925 258.0000
0.000962 258.5000
0.000999 259.0000
0.001036 258.5000
0.001073 258.7500
0.001110 258.7500
0.001147 259.0000

Weighed data:
0.000000 20.6800
0.000037 23.1588
0.000074 30.3167
0.000111 42.0336
0.000148 57.7765
0.000185 76.8392
0.000222 98.4821
0.000259 121.8189
0.000296 145.8943
0.000333 169.7227
0.000370 192.3286
0.000407 212.7863
0.000444 230.0362
0.000481 244.0297
0.000518 253.2914
0.000555 258.3887
0.000592 258.1393
0.000629 252.8020
0.000666 243.5586
0.000703 229.5917
0.000740 212.1701
0.000777 191.5860
0.000814 169.0674
0.000851 145.4719
0.000888 121.5837
0.000925 98.1018
0.000962 76.6909
0.000999 57.7765
0.001036 41.9930
0.001073 30.3460
0.001110 23.1364
0.001147 20.7200

Computed Real values:
0.000000 4350.3191
1.000000 84745.3427
2.000000 -103948.4590
3.000000 385082.4235
4.000000 -430954.2415
5.000000 677876.2510
6.000000 -612272.3399
7.000000 102001.9826
8.000000 170997.9673
9.000000 410557.3047
10.000000 -741763.6562
11.000000 -207147.5943
12.000000 -434936.3192
13.000000 428518.8342
14.000000 -309130.3797
15.000000 -259522.5893
16.000000 -0.0285
17.000000 259522.3897
18.000000 309130.2473
19.000000 -428519.1947
20.000000 434937.6143
21.000000 207148.0941
22.000000 741764.6016
23.000000 -410556.4801
24.000000 -170995.1651
25.000000 -101997.5631
26.000000 612277.9132
27.000000 -677867.4988
28.000000 430970.2326
29.000000 -385053.8745
30.000000 104032.8027
31.000000 -88587.1767

Computed Imaginary values:
0.000000 -0.0000
1.000000 -342442.5043
2.000000 -268973.8565
3.000000 -52914.2848
4.000000 1193488.5928
5.000000 -279891.4694
6.000000 -194734.6020
7.000000 356769.0060
8.000000 -134266.6811
9.000000 95200.0749
10.000000 10577.8445
11.000000 142597.1198
12.000000 398715.3934
13.000000 -92351.5723
14.000000 -469952.0439
15.000000 -361834.9687
16.000000 -300.1319
17.000000 -361834.1598
18.000000 -469954.0397
19.000000 -92351.2018
20.000000 398712.9950
21.000000 142597.1762
22.000000 10576.3062
23.000000 95198.4125
24.000000 -134270.6838
25.000000 356767.3069
26.000000 -194739.1875
27.000000 -279895.8059
28.000000 1193481.8639
29.000000 -52922.4418
30.000000 -268995.5601
31.000000 -342056.8967

Computed magnitudes:
0.000000Hz 4350.3191
844.594604Hz 352772.7906
1689.189209Hz 288361.2623
2533.783813Hz 388700.9061
3378.378418Hz 1268911.5727
4222.973022Hz 733386.2872
5067.567627Hz 642494.3450
5912.162231Hz 371064.0485
6756.756836Hz 217411.6981
7601.351440Hz 421450.2992
8445.946045Hz 741839.0745
9290.540649Hz 251483.7259
10135.135254Hz 590036.9198
10979.729858Hz 438357.3932
11824.324463Hz 562509.1246
12668.919067Hz 445282.5158

Data:
0.000000 261.0000
0.000037 261.0000
0.000074 261.0000
0.000111 260.5000
0.000148 261.0000
0.000185 261.0000
0.000222 261.0000
0.000259 261.0000
0.000296 261.0000
0.000333 261.0000
0.000370 261.0000
0.000407 261.0000
0.000444 261.0000
0.000481 261.0000
0.000518 261.0000
0.000555 261.0000
0.000592 261.0000
0.000629 261.0000
0.000666 261.0000
0.000703 261.0000
0.000740 261.0000
0.000777 261.0000
0.000814 261.0000
0.000851 261.0000
0.000888 261.0000
0.000925 261.0000
0.000962 261.0000
0.000999 261.0000
0.001036 261.0000
0.001073 261.0000
0.001110 261.0000
0.001147 261.0000

Weighed data:
0.000000 20.8800
0.000037 23.3376
0.000074 30.6099
0.000111 42.3179
0.000148 58.2226
0.000185 77.4326
0.000222 99.2425
0.000259 122.7596
0.000296 147.0209
0.000333 171.0333
0.000370 193.8137
0.000407 214.4294
0.000444 232.0365
0.000481 245.9141
0.000518 255.4940
0.000555 260.3840
0.000592 260.3840
0.000629 255.4940
0.000666 245.9141
0.000703 232.0365
0.000740 214.4294
0.000777 193.8137
0.000814 171.0333
0.000851 147.0209
0.000888 122.7596
0.000925 99.2425
0.000962 77.4326
0.000999 58.2226
0.001036 42.3991
0.001073 30.6099
0.001110 23.3376
0.001147 20.8800

Computed Real values:
0.000000 4389.9388
1.000000 1537226.6765
2.000000 3213826.8982
3.000000 -560302.2866
4.000000 -1024402.9864
5.000000 -920196.0938
6.000000 1287058.3423
7.000000 691720.1334
8.000000 -554721.9839
9.000000 1158271.9077
10.000000 1452463.6324
11.000000 1714225.7111
12.000000 -2303473.6872
13.000000 -1397589.9422
14.000000 372941.3809
15.000000 262496.5737
16.000000 0.0812
17.000000 -262496.4145
18.000000 -372941.2204
19.000000 1397590.1393
20.000000 2303473.9991
21.000000 -1714225.1589
22.000000 -1452462.6687
23.000000 -1158270.3138
24.000000 554724.4929
25.000000 -691716.2989
26.000000 -1287052.4987
27.000000 920205.2705
28.000000 1024418.5017
29.000000 560332.7186
30.000000 -3213741.9979
31.000000 -1541104.6862

Computed Imaginary values:
0.000000 0.0000
1.000000 2257208.0810
2.000000 -2294511.3309
3.000000 -2462237.1287
4.000000 -2298487.7851
5.000000 1475269.7260
6.000000 84782.9171
7.000000 479336.5288
8.000000 822616.8884
9.000000 2816504.2658
10.000000 1755570.0114
11.000000 -2409809.2842
12.000000 -1181432.7411
13.000000 -960680.9390
14.000000 371952.4711
15.000000 1543768.7101
16.000000 -27.9032
17.000000 1543768.3753
18.000000 371951.8269
19.000000 -960681.8522
20.000000 -1181433.8863
21.000000 -2409810.6470
22.000000 1755568.4068
23.000000 2816502.3488
24.000000 822614.5419
25.000000 479333.5910
26.000000 84779.1750
27.000000 1475264.8744
28.000000 -2298494.2790
29.000000 -2462246.5099
30.000000 -2294528.3811
31.000000 2257589.9280

Computed magnitudes:
0.000000Hz 4389.9388
844.594604Hz 2730943.8251
1689.189209Hz 3948856.2369
2533.783813Hz 2525183.2271
3378.378418Hz 2516435.4903
4222.973022Hz 1738729.8857
5067.567627Hz 1289847.7892
5912.162231Hz 841570.1104
6756.756836Hz 992176.9119
7601.351440Hz 3045371.9134
8445.946045Hz 2278525.1081
9290.540649Hz 2957321.5203
10135.135254Hz 2588778.5439
10979.729858Hz 1695926.1520
11824.324463Hz 526719.9581
12668.919067Hz 1565926.6527

Data:
0.000000 261.0000
0.000037 261.0000
0.000074 261.0000
0.000111 261.0000
0.000148 261.0000
0.000185 261.0000
0.000222 261.0000
0.000259 260.5000
0.000296 261.0000
0.000333 260.7500
0.000370 261.0000
0.000407 260.5000
0.000444 261.0000
0.000481 261.0000
0.000518 261.0000
0.000555 261.2500
0.000592 261.0000
0.000629 260.5000
0.000666 261.0000
0.000703 261.0000
0.000740 260.5000
0.000777 261.0000
0.000814 260.5000
0.000851 261.0000
0.000888 261.0000
0.000925 261.0000
0.000962 261.0000
0.000999 261.0000
0.001036 261.0000
0.001073 261.0000
0.001110 260.5000
0.001147 261.2500

Weighed data:
0.000000 20.8800
0.000037 23.3376
0.000074 30.6099
0.000111 42.3991
0.000148 58.2226
0.000185 77.4326
0.000222 99.2425
0.000259 122.5244
0.000296 147.0209
0.000333 170.8695
0.000370 193.8137
0.000407 214.0187
0.000444 232.0365
0.000481 245.9141
0.000518 255.4940
0.000555 260.6334
0.000592 260.3840
0.000629 255.0045
0.000666 245.9141
0.000703 232.0365
0.000740 214.0187
0.000777 193.8137
0.000814 170.7057
0.000851 147.0209
0.000888 122.7596
0.000925 99.2425
0.000962 77.4326
0.000999 58.2226
0.001036 42.3991
0.001073 30.6099
0.001110 23.2929
0.001147 20.9000

Computed Real values:
0.000000 4388.2070
1.000000 -603871.0391
2.000000 -9992781.9862
3.000000 -12915822.2571
4.000000 8609233.4399
5.000000 -5537334.1662
6.000000 2382537.6633
7.000000 -551453.8708
8.000000 3871524.9446
9.000000 -10976682.9095
10.000000 -725222.4639
11.000000 -2899127.6356
12.000000 2186677.4870
13.000000 2183041.4002
14.000000 -7551233.5028
15.000000 91700.9401
16.000000 0.2467
17.000000 -91701.1056
18.000000 7551233.3562
19.000000 -2183042.0980
20.000000 -2186675.9442
21.000000 2899128.0752
22.000000 725223.7996
23.000000 10976684.0818
24.000000 -3871522.5125
25.000000 551458.9523
26.000000 -2382532.9920
27.000000 5537343.5729
28.000000 -8609217.5124
29.000000 12915851.1428
30.000000 9992867.9939
31.000000 599994.8523

Computed Imaginary values:
0.000000 -0.0000
1.000000 -1739846.9138
2.000000 22278718.9820
3.000000 4178151.0113
4.000000 -7674898.2874
5.000000 -3772285.6362
6.000000 -3570916.0202
7.000000 922010.0731
8.000000 -5517126.8432
9.000000 -5339351.9622
10.000000 5788460.0467
11.000000 -3438540.5100
12.000000 3194020.0145
13.000000 3561679.9838
14.000000 3559576.3113
15.000000 -12429663.6982
16.000000 -299.2186
17.000000 -12429666.3487
18.000000 3559577.1625
19.000000 3561680.1191
20.000000 3194016.6862
21.000000 -3438539.5342
22.000000 5788456.1100
23.000000 -5339352.9636
24.000000 -5517129.9057
25.000000 922008.1684
26.000000 -3570921.2514
27.000000 -3772289.6473
28.000000 -7674905.4750
29.000000 4178143.5042
30.000000 22278700.9838
31.000000 -1739464.9412

Computed magnitudes:
0.000000Hz 4388.2070
844.594604Hz 1841664.3330
1689.189209Hz 24417145.8468
2533.783813Hz 13574807.9342
3378.378418Hz 11533558.1736
4222.973022Hz 6700164.8181
5067.567627Hz 4292776.1344
5912.162231Hz 1074338.8416
6756.756836Hz 6739984.7182
7601.351440Hz 12206401.8888
8445.946045Hz 5833713.8544
9290.540649Hz 4497610.6864
10135.135254Hz 3870829.6636
10979.729858Hz 4177467.4220
11824.324463Hz 8348156.1395
12668.919067Hz 12430001.9595

Data:
0.000000 260.7500
0.000037 260.5000
0.000074 260.7500
0.000111 260.7500
0.000148 260.0000
0.000185 261.5000
0.000222 261.7500
0.000259 261.0000
0.000296 261.5000
0.000333 261.7500
0.000370 260.7500
0.000407 261.2500
0.000444 261.5000
0.000481 261.2500
0.000518 261.2500
0.000555 261.5000
0.000592 260.7500
0.000629 261.0000
0.000666 261.7500
0.000703 261.5000
0.000740 261.0000
0.000777 261.7500
0.000814 261.5000
0.000851 261.5000
0.000888 261.5000
0.000925 261.7500
0.000962 261.2500
0.000999 261.5000
0.001036 261.7500
0.001073 261.5000
0.001110 261.5000
0.001147 261.7500

Weighed data:
0.000000 20.8600
0.000037 23.2929
0.000074 30.5806
0.000111 42.3585
0.000148 57.9996
0.000185 77.5809
0.000222 99.5277
0.000259 122.7596
0.000296 147.3026
0.000333 171.5248
0.000370 193.6281
0.000407 214.6348
0.000444 232.4810
0.000481 246.1496
0.000518 255.7387
0.000555 260.8828
0.000592 260.1346
0.000629 255.4940
0.000666 246.6207
0.000703 232.4810
0.000740 214.4294
0.000777 194.3707
0.000814 171.3610
0.000851 147.3026
0.000888 122.9948
0.000925 99.5277
0.000962 77.5068
0.000999 58.3342
0.001036 42.5210
0.001073 30.6686
0.001110 23.3823
0.001147 20.9400

Computed Real values:
0.000000 4395.3715
1.000000 30168122.6404
2.000000 -21869500.9970
3.000000 23218646.6169
4.000000 -30783173.0721
5.000000 53185430.3747
6.000000 -30546504.0522
7.000000 40029993.3944
8.000000 -10208269.0461
9.000000 35886544.5087
10.000000 -51564595.2748
11.000000 -17323926.5228
12.000000 -17998836.5898
13.000000 48857718.9529
14.000000 -7694519.0198
15.000000 -22629485.1702
16.000000 -1.2339
17.000000 22629486.1162
18.000000 7694519.4574
19.000000 -48857719.5935
20.000000 17998837.0340
21.000000 17323929.8290
22.000000 51564593.9755
23.000000 -35886542.2430
24.000000 10208269.8002
25.000000 -40029987.7315
26.000000 30546507.6974
27.000000 -53185419.2547
28.000000 30783188.0717
29.000000 -23218615.1219
30.000000 21869583.7916
31.000000 -30172005.1891

Computed Imaginary values:
0.000000 0.0000
1.000000 -41162554.7686
2.000000 -43123663.1866
3.000000 -1932275.1192
4.000000 55407157.9527
5.000000 836945.3689
6.000000 -9272762.3670
7.000000 45234736.0849
8.000000 21241880.9507
9.000000 -3704027.8210
10.000000 -6345798.2122
11.000000 -3547002.2744
12.000000 22219072.1996
13.000000 9932068.2870
14.000000 -54044630.0985
15.000000 8260704.3224
16.000000 -26.8970
17.000000 8260703.9528
18.000000 -54044630.5072
19.000000 9932068.0800
20.000000 22219071.2946
21.000000 -3547001.7299
22.000000 -6345805.4417
23.000000 -3704027.7052
24.000000 21241878.7819
25.000000 45234732.7749
26.000000 -9272765.4305
27.000000 836940.8109
28.000000 55407150.3532
29.000000 -1932285.2163
30.000000 -43123680.0132
31.000000 -41162174.4261

Computed magnitudes:
0.000000Hz 4395.3715
844.594604Hz 51034023.3445
1689.189209Hz 48352098.2016
2533.783813Hz 23298910.6582
3378.378418Hz 63384200.6874
4222.973022Hz 53192015.2061
5067.567627Hz 31922923.2954
5912.162231Hz 60403490.9573
6756.756836Hz 23567483.1758
7601.351440Hz 36077193.6114
8445.946045Hz 51953600.8454
9290.540649Hz 17683315.7327
10135.135254Hz 28594497.5126
10979.729858Hz 49857022.3914
11824.324463Hz 54589629.6510
12668.919067Hz 24090098.2764

Data:
0.000000 259.0000
0.000037 260.0000
0.000074 260.5000
0.000111 259.5000
0.000148 259.5000
0.000185 260.0000
0.000222 259.5000
0.000259 259.7500
0.000296 260.0000
0.000333 260.0000
0.000370 259.5000
0.000407 260.5000
0.000444 260.0000
0.000481 259.5000
0.000518 260.0000
0.000555 260.5000
0.000592 259.5000
0.000629 259.5000
0.000666 260.5000
0.000703 259.5000
0.000740 259.5000
0.000777 260.0000
0.000814 260.0000
0.000851 259.7500
0.000888 260.5000
0.000925 260.0000
0.000962 259.5000
0.000999 260.0000
0.001036 260.5000
0.001073 260.0000
0.001110 260.5000
0.001147 260.5000

Weighed data:
0.000000 20.7200
0.000037 23.2482
0.000074 30.5513
0.000111 42.1555
0.000148 57.8880
0.000185 77.1359
0.000222 98.6722
0.000259 122.1717
0.000296 146.4576
0.000333 170.3780
0.000370 192.6998
0.000407 214.0187
0.000444 231.1475
0.000481 244.5008
0.000518 254.5151
0.000555 259.8852
0.000592 258.8876
0.000629 254.0256
0.000666 245.4430
0.000703 230.7030
0.000740 213.1971
0.000777 193.0711
0.000814 170.3780
0.000851 146.3168
0.000888 122.5244
0.000925 98.8623
0.000962 76.9876
0.000999 57.9996
0.001036 42.3179
0.001073 30.4926
0.001110 23.2929
0.001147 20.8400

Computed Real values:
0.000000 4371.4849
1.000000 -56963449.8227
2.000000 263293747.4189
3.000000 -20139776.5529
4.000000 52657586.3625
5.000000 -112120956.0984
6.000000 190224416.6532
7.000000 57729317.4562
8.000000 -54459445.9881
9.000000 -13503022.7039
10.000000 81779040.6805
11.000000 46643686.1966
12.000000 10101902.5057
13.000000 -26318082.0000
14.000000 73719816.3886
15.000000 36394309.8373
16.000000 -0.1250
17.000000 -36394310.0922
18.000000 -73719815.5939
19.000000 26318081.6800
20.000000 -10101902.4189
21.000000 -46643683.1218
22.000000 -81779045.8517
23.000000 13503028.0555
24.000000 54459447.1886
25.000000 -57729313.3401
26.000000 -190224411.5891
27.000000 112120963.9986
28.000000 -52657570.2929
29.000000 20139807.2996
30.000000 -263293663.1025
31.000000 56959588.5275

Computed Imaginary values:
0.000000 -0.0000
1.000000 224342837.4800
2.000000 -93030013.0591
3.000000 -120173182.0792
4.000000 -272700213.4034
5.000000 69891680.4149
6.000000 -35745464.5016
7.000000 -46612932.6106
8.000000 11975318.9869
9.000000 110431773.6360
10.000000 114956261.6468
11.000000 -180730033.8876
12.000000 -84148922.5488
13.000000 87143404.3416
14.000000 29392765.3178
15.000000 185006706.1394
16.000000 -297.3625
17.000000 185006708.1499
18.000000 29392763.0359
19.000000 87143404.3043
20.000000 -84148924.4713
21.000000 -180730033.1515
22.000000 114956255.6061
23.000000 110431775.0297
24.000000 11975314.2355
25.000000 -46612934.1360
26.000000 -35745467.9535
27.000000 69891675.0611
28.000000 -272700220.0321
29.000000 -120173190.0518
30.000000 -93030031.7943
31.000000 224343217.6577

Computed magnitudes:
0.000000Hz 4371.4849
844.594604Hz 231461753.5237
1689.189209Hz 279245735.4368
2533.783813Hz 121849104.5952
3378.378418Hz 277737696.0223
4222.973022Hz 132120989.2017
5067.567627Hz 193553783.0255
5912.162231Hz 74198649.4521
6756.756836Hz 55760555.2535
7601.351440Hz 111254250.4830
8445.946045Hz 141077119.2874
9290.540649Hz 186652025.4672
10135.135254Hz 84753109.6796
10979.729858Hz 91030842.9072
11824.324463Hz 79363379.3471
12668.919067Hz 188552451.8671

Data:
0.000000 260.7500
0.000037 261.0000
0.000074 261.0000
0.000111 261.0000
0.000148 261.0000
0.000185 261.0000
0.000222 261.0000
0.000259 261.0000
0.000296 261.0000
0.000333 261.0000
0.000370 261.0000
0.000407 261.0000
0.000444 261.0000
0.000481 261.0000
0.000518 261.0000
0.000555 261.0000
0.000592 261.0000
0.000629 261.0000
0.000666 260.5000
0.000703 260.5000
0.000740 260.7500
0.000777 261.0000
0.000814 261.0000
0.000851 261.0000
0.000888 260.2500
0.000925 260.5000
0.000962 260.5000
0.000999 260.0000
0.001036 260.0000
0.001073 260.5000
0.001110 260.0000
0.001147 260.0000

Weighed data:
0.000000 20.8600
0.000037 23.3376
0.000074 30.6099
0.000111 42.3991
0.000148 58.2226
0.000185 77.4326
0.000222 99.2425
0.000259 122.7596
0.000296 147.0209
0.000333 171.0333
0.000370 193.8137
0.000407 214.4294
0.000444 232.0365
0.000481 245.9141
0.000518 255.4940
0.000555 260.3840
0.000592 260.3840
0.000629 255.4940
0.000666 245.4430
0.000703 231.5920
0.000740 214.2241
0.000777 193.8137
0.000814 171.0333
0.000851 147.0209
0.000888 122.4068
0.000925 99.0524
0.000962 77.2842
0.000999 57.9996
0.001036 42.2367
0.001073 30.5513
0.001110 23.2482
0.001147 20.8000

Computed Real values:
0.000000 4387.5742
1.000000 -466439884.1393
2.000000 -827762733.3112
3.000000 -588176424.0098
4.000000 264990006.1452
5.000000 -533969408.4538
6.000000 -103059322.3383
7.000000 -284093666.1741
8.000000 524103289.3768
9.000000 -734329531.7082
10.000000 -311115724.7153
11.000000 -492717033.0493
12.000000 586511263.7490
13.000000 499906978.5453
14.000000 -554018631.7123
15.000000 -86988122.7785
16.000000 -0.4531
17.000000 86988123.2524
18.000000 554018631.9041
19.000000 -499906978.2164
20.000000 -586511263.9770
21.000000 492717034.3428
22.000000 311115726.4756
23.000000 734329533.2793
24.000000 -524103286.9313
25.000000 284093668.8893
26.000000 103059329.8820
27.000000 533969415.5552
28.000000 -264989990.1096
29.000000 588176455.2408
30.000000 827762818.3454
31.000000 466436007.0400

Computed Imaginary values:
0.000000 0.0000
1.000000 -331543163.4908
2.000000 1428934055.2772
3.000000 432729339.7366
4.000000 352850153.8319
5.000000 -446553604.3593
6.000000 -7603545.5359
7.000000 -91497225.2580
8.000000 -548054560.6355
9.000000 -605258769.0869
10.000000 317595878.0782
11.000000 -408875472.9879
12.000000 239762995.7745
13.000000 525062441.5750
14.000000 11257753.5567
15.000000 -868806427.9670
16.000000 -28.2539
17.000000 -868806428.8062
18.000000 11257753.3844
19.000000 525062440.9310
20.000000 239762994.7873
21.000000 -408875475.3235
22.000000 317595877.2793
23.000000 -605258771.1224
24.000000 -548054562.1469
25.000000 -91497229.3595
26.000000 -7603548.9605
27.000000 -446553607.9687
28.000000 352850145.3759
29.000000 432729332.0983
30.000000 1428934037.8671
31.000000 -331542778.2905

Computed magnitudes:
0.000000Hz 4387.5742
844.594604Hz 572264829.2298
1689.189209Hz 1651376297.8164
2533.783813Hz 730209687.1651
3378.378418Hz 441274216.8041
4222.973022Hz 696084370.4112
5067.567627Hz 103339430.1588
5912.162231Hz 298464325.1549
6756.756836Hz 758319233.1525
7601.351440Hz 951618641.4186
8445.946045Hz 444589851.3657
9290.540649Hz 640272775.5168
10135.135254Hz 633625880.6640
10979.729858Hz 724981071.9950
11824.324463Hz 554132999.6486
12668.919067Hz 873150355.1974

Data:
0.000000 263.0000
0.000037 262.5000
0.000074 263.0000
0.000111 263.5000
0.000148 262.5000
0.000185 263.0000
0.000222 263.5000
0.000259 262.5000
0.000296 263.0000
0.000334 263.5000
0.000371 263.0000
0.000408 262.5000
0.000445 263.5000
0.000482 263.0000
0.000519 262.5000
0.000556 263.5000
0.000593 263.0000
0.000630 262.5000
0.000667 263.5000
0.000704 263.0000
0.000741 263.0000
0.000778 263.5000
0.000815 263.5000
0.000852 263.0000
0.000889 263.5000
0.000927 263.5000
0.000964 262.5000
0.001001 263.5000
0.001038 263.0000
0.001075 262.0000
0.001112 263.5000
0.001149 263.0000

Weighed data:
0.000000 21.0400
0.000037 23.4718
0.000074 30.8445
0.000111 42.8053
0.000148 58.5572
0.000185 78.0259
0.000222 100.1931
0.000259 123.4651
0.000296 148.1475
0.000334 172.6716
0.000371 195.2989
0.000408 215.6618
0.000445 234.2591
0.000482 247.7985
0.000519 256.9623
0.000556 262.8781
0.000593 262.3793
0.000630 256.9623
0.000667 248.2696
0.000704 233.8146
0.000741 216.0726
0.000778 195.6702
0.000815 172.6716
0.000852 148.1475
0.000889 123.9354
0.000927 100.1931
0.000964 77.8776
0.001001 58.7803
0.001038 42.7240
0.001075 30.7272
0.001112 23.5612
0.001149 21.0400

Computed Real values:
0.000000 4424.9072
1.000000 3481084172.7668
2.000000 -317182058.2087
3.000000 2949371941.5932
4.000000 -3168814397.1237
5.000000 1949328296.1850
6.000000 -1169840938.3432
7.000000 2056580475.9558
8.000000 -1578523424.3030
9.000000 3765627565.0706
10.000000 -1951487260.6979
11.000000 -188097728.2196
12.000000 -865075029.8242
13.000000 2298422335.1291
14.000000 -1120417701.4526
15.000000 -1293028076.9039
16.000000 0.6807
17.000000 1293028076.1831
18.000000 1120417701.2664
19.000000 -2298422333.5778
20.000000 865075029.7599
21.000000 188097729.6966
22.000000 1951487261.8786
23.000000 -3765627565.0589
24.000000 1578523427.1759
25.000000 -2056580471.8658
26.000000 1169840944.0516
27.000000 -1949328287.4388
28.000000 3168814412.7454
29.000000 -2949371909.5550
30.000000 317182142.1965
31.000000 -3481088081.3892

Computed Imaginary values:
0.000000 -0.0000
1.000000 -2130251466.7825
2.000000 ovf
3.000000 -473561734.4012
4.000000 3915640521.0325
5.000000 464967158.9889
6.000000 -432628442.5789
7.000000 2326062367.3702
8.000000 2674632172.9667
9.000000 1643730835.7251
10.000000 -157458684.1448
11.000000 -2053483793.1179
12.000000 -469791610.5473
13.000000 1364482912.1049
14.000000 -2964963585.1081
15.000000 1510398842.4176
16.000000 -302.9822
17.000000 1510398841.8312
18.000000 -2964963586.4922
19.000000 1364482913.5212
20.000000 -469791613.1486
21.000000 -2053483788.3613
22.000000 -157458693.1388
23.000000 1643730834.9732
24.000000 2674632170.8225
25.000000 2326062364.0898
26.000000 -432628447.0281
27.000000 464967154.6160
28.000000 3915640514.0404
29.000000 -473561743.3667
30.000000 ovf
31.000000 -2130251083.7561

Computed magnitudes:
0.000000Hz 4424.9072
843.170349Hz 4081166295.2662
1686.340698Hz ovf
2529.511047Hz 2987148400.4224
3372.681396Hz ovf
4215.851746Hz 2004014786.6834
5059.022095Hz 1247275106.1221
5902.192444Hz 3104849334.6664
6745.362793Hz 3105703376.3291
7588.533142Hz 4108747013.2795
8431.703491Hz 1957829350.5510
9274.873840Hz 2062080610.4416
10118.044189Hz 984407925.8956
10961.214539Hz 2672930760.0547
11804.384888Hz 3169596959.6694
12647.555237Hz 1988272182.2825

Data:
0.000000 260.0000
0.000037 261.2500
0.000074 260.7500
0.000111 260.5000
0.000148 261.0000
0.000185 260.5000
0.000222 260.2500
0.000259 261.0000
0.000296 261.5000
0.000333 260.5000
0.000370 260.7500
0.000407 261.0000
0.000444 260.5000
0.000481 260.5000
0.000518 261.2500
0.000555 260.2500
0.000592 260.7500
0.000629 260.5000
0.000666 260.5000
0.000703 260.2500
0.000740 260.7500
0.000777 260.2500
0.000814 260.5000
0.000851 260.5000
0.000888 260.5000
0.000925 260.0000
0.000962 260.7500
0.000999 260.7500
0.001036 260.0000
0.001073 260.7500
0.001110 261.2500
0.001147 260.2500

Weighed data:
0.000000 20.8000
0.000037 23.3600
0.000074 30.5806
0.000111 42.3179
0.000148 58.2226
0.000185 77.2842
0.000222 98.9574
0.000259 122.7596
0.000296 147.3026
0.000333 170.7057
0.000370 193.6281
0.000407 214.4294
0.000444 231.5920
0.000481 245.4430
0.000518 255.7387
0.000555 259.6358
0.000592 260.1346
0.000629 255.0045
0.000666 245.4430
0.000703 231.3697
0.000740 214.2241
0.000777 193.2568
0.000814 170.7057
0.000851 146.7393
0.000888 122.5244
0.000925 98.8623
0.000962 77.3584
0.000999 58.1669
0.001036 42.2367
0.001073 30.5806
0.001110 23.3600
0.001147 20.8200

Computed Real values:
0.000000 4383.5444
1.000000 ovf
2.000000 ovf
3.000000 -1867390497.7863
4.000000 ovf
5.000000 ovf
6.000000 ovf
7.000000 61570578.0732
8.000000 -2254170799.3444
9.000000 ovf
10.000000 ovf
11.000000 3693276667.1292
12.000000 ovf
13.000000 ovf
14.000000 -2559764974.9535
15.000000 ovf
16.000000 2.0731
17.000000 ovf
18.000000 2559764976.1052
19.000000 ovf
20.000000 ovf
21.000000 -3693276666.4885
22.000000 ovf
23.000000 ovf
24.000000 2254170801.8748
25.000000 -61570574.3600
26.000000 ovf
27.000000 ovf
28.000000 ovf
29.000000 1867390528.3676
30.000000 ovf
31.000000 ovf

Computed Imaginary values:
0.000000 0.0000
1.000000 ovf
2.000000 2857842087.6224
3.000000 -3092426378.4716
4.000000 ovf
5.000000 -1312817152.6850
6.000000 ovf
7.000000 ovf
8.000000 -3095094191.8658
9.000000 ovf
10.000000 ovf
11.000000 ovf
12.000000 ovf
13.000000 ovf
14.000000 ovf
15.000000 3766801049.3309
16.000000 -26.0295
17.000000 3766801049.2990
18.000000 ovf
19.000000 ovf
20.000000 ovf
21.000000 ovf
22.000000 ovf
23.000000 ovf
24.000000 -3095094195.3489
25.000000 ovf
26.000000 ovf
27.000000 -1312817155.8596
28.000000 ovf
29.000000 -3092426387.8442
30.000000 2857842068.8706
31.000000 ovf

Computed magnitudes:
0.000000Hz 4383.5444
844.594604Hz ovf
1689.189209Hz ovf
2533.783813Hz 3612512723.5056
3378.378418Hz ovf
4222.973022Hz ovf
5067.567627Hz ovf
5912.162231Hz ovf
6756.756836Hz 3828954694.0567
7601.351440Hz ovf
8445.946045Hz ovf
9290.540649Hz ovf
10135.135254Hz ovf
10979.729858Hz ovf
11824.324463Hz ovf
12668.919067Hz ovf

Data:
0.000000 259.0000
0.000037 259.0000
0.000074 259.0000
0.000111 259.0000
0.000148 259.5000
0.000185 259.0000
0.000222 259.0000
0.000259 259.2500
0.000296 259.0000
0.000333 259.0000
0.000370 259.5000
0.000407 259.0000
0.000444 259.5000
0.000481 259.2500
0.000518 259.0000
0.000555 259.5000
0.000592 259.5000
0.000629 259.7500
0.000666 259.5000
0.000703 260.0000
0.000740 259.5000
0.000777 259.5000
0.000814 259.0000
0.000851 259.0000
0.000888 259.0000
0.000925 259.0000
0.000962 259.5000
0.000999 259.5000
0.001036 259.0000
0.001073 259.0000
0.001110 259.5000
0.001147 259.5000

Weighed data:
0.000000 20.7200
0.000037 23.1588
0.000074 30.3754
0.000111 42.0742
0.000148 57.8880
0.000185 76.8392
0.000222 98.4821
0.000259 121.9365
0.000296 145.8943
0.000333 169.7227
0.000370 192.6998
0.000407 212.7863
0.000444 230.7030
0.000481 244.2652
0.000518 253.5362
0.000555 258.8876
0.000592 258.8876
0.000629 254.2703
0.000666 244.5008
0.000703 231.1475
0.000740 213.1971
0.000777 192.6998
0.000814 169.7227
0.000851 145.8943
0.000888 121.8189
0.000925 98.4821
0.000962 76.9876
0.000999 57.8880
0.001036 42.0742
0.001073 30.3754
0.001110 23.2035
0.001147 20.7600

Computed Real values:
0.000000 4361.8791
1.000000 ovf
2.000000 ovf
3.000000 ovf
4.000000 ovf
5.000000 ovf
6.000000 ovf
7.000000 -2261501754.8349
8.000000 ovf
9.000000 ovf
10.000000 ovf
11.000000 ovf
12.000000 ovf
13.000000 ovf
14.000000 ovf
15.000000 ovf
16.000000 -0.4969
17.000000 ovf
18.000000 ovf
19.000000 ovf
20.000000 ovf
21.000000 ovf
22.000000 ovf
23.000000 ovf
24.000000 ovf
25.000000 2261501757.5809
26.000000 ovf
27.000000 ovf
28.000000 ovf
29.000000 ovf
30.000000 ovf
31.000000 ovf

Computed Imaginary values:
0.000000 -0.0009
1.000000 ovf
2.000000 ovf
3.000000 ovf
4.000000 ovf
5.000000 ovf
6.000000 ovf
7.000000 ovf
8.000000 ovf
9.000000 ovf
10.000000 ovf
11.000000 ovf
12.000000 ovf
13.000000 ovf
14.000000 ovf
15.000000 ovf
16.000000 -304.1259
17.000000 ovf
18.000000 ovf
19.000000 ovf
20.000000 ovf
21.000000 ovf
22.000000 ovf
23.000000 ovf
24.000000 ovf
25.000000 ovf
26.000000 ovf
27.000000 ovf
28.000000 ovf
29.000000 ovf
30.000000 ovf
31.000000 ovf

Computed magnitudes:
0.000000Hz 4361.8791
844.594604Hz ovf
1689.189209Hz ovf
2533.783813Hz ovf
3378.378418Hz ovf
4222.973022Hz ovf
5067.567627Hz ovf
5912.162231Hz ovf
6756.756836Hz ovf
7601.351440Hz ovf
8445.946045Hz ovf
9290.540649Hz ovf
10135.135254Hz ovf
10979.729858Hz ovf
11824.324463Hz ovf
12668.919067Hz ovf

Data:
0.000000 262.0000
0.000037 262.0000
0.000074 262.0000
0.000111 262.0000
0.000148 262.0000
0.000185 262.0000
0.000222 262.0000
0.000259 262.0000
0.000296 262.0000
0.000333 262.0000
0.000370 262.0000
0.000407 262.0000
0.000444 262.0000
0.000481 262.0000
0.000518 262.0000
0.000555 262.0000
0.000593 262.0000
0.000630 262.0000
0.000667 262.0000
0.000704 262.0000
0.000741 262.0000
0.000778 262.0000
0.000815 262.0000
0.000852 261.7500
0.000889 262.0000
0.000926 262.0000
0.000963 262.0000
0.001000 262.5000
0.001037 261.7500
0.001074 262.2500
0.001111 262.5000
0.001148 261.7500

Weighed data:
0.000000 20.9600
0.000037 23.4271
0.000074 30.7272
0.000111 42.5616
0.000148 58.4457
0.000185 77.7293
0.000222 99.6228
0.000259 123.2299
0.000296 147.5842
0.000333 171.6886
0.000370 194.5563
0.000407 215.2510
0.000444 232.9255
0.000481 246.8563
0.000518 256.4729
0.000555 261.3817
0.000593 261.3817
0.000630 256.4729
0.000667 246.8563
0.000704 232.9255
0.000741 215.2510
0.000778 194.5563
0.000815 171.6886
0.000852 147.4434
0.000889 123.2299
0.000926 99.6228
0.000963 77.7293
0.001000 58.5572
0.001037 42.5210
0.001074 30.7565
0.001111 23.4718
0.001148 20.9400

Computed Real values:
0.000000 4406.8241
1.000000 ovf
2.000000 ovf
3.000000 ovf
4.000000 ovf
5.000000 ovf
6.000000 ovf
7.000000 ovf
8.000000 ovf
9.000000 ovf
10.000000 ovf
11.000000 ovf
12.000000 ovf
13.000000 ovf
14.000000 ovf
15.000000 ovf
16.000000 0.0241
17.000000 ovf
18.000000 ovf
19.000000 ovf
20.000000 ovf
21.000000 ovf
22.000000 ovf
23.000000 ovf
24.000000 ovf
25.000000 ovf
26.000000 ovf
27.000000 ovf
28.000000 ovf
29.000000 ovf
30.000000 ovf
31.000000 ovf

Computed Imaginary values:
0.000000 0.0003
1.000000 ovf
2.000000 ovf
3.000000 ovf
4.000000 ovf
5.000000 ovf
6.000000 ovf
7.000000 ovf
8.000000 ovf
9.000000 ovf
10.000000 ovf
11.000000 ovf
12.000000 ovf
13.000000 ovf
14.000000 ovf
15.000000 ovf
16.000000 -19.2386
17.000000 ovf
18.000000 ovf
19.000000 ovf
20.000000 ovf
21.000000 ovf
22.000000 ovf
23.000000 ovf
24.000000 ovf
25.000000 ovf
26.000000 ovf
27.000000 ovf
28.000000 ovf
29.000000 ovf
30.000000 ovf
31.000000 ovf

Computed magnitudes:
0.000000Hz 4406.8241
843.881836Hz ovf
1687.763672Hz ovf
2531.645508Hz ovf
3375.527344Hz ovf
4219.409180Hz ovf
5063.291016Hz ovf
5907.172852Hz ovf
6751.054688Hz ovf
7594.936523Hz ovf
8438.818359Hz ovf
9282.700195Hz ovf
10126.582031Hz ovf
10970.463867Hz ovf
11814.345703Hz ovf
12658.227539Hz ovf

Data:
0.000000 258.2500
0.000037 258.7500
0.000074 258.5000
0.000111 258.0000
0.000148 258.7500
0.000185 258.5000
0.000222 258.5000
0.000259 259.0000
0.000296 259.0000
0.000333 259.0000
0.000370 258.7500
0.000407 258.5000
0.000444 259.0000
0.000481 258.5000
0.000518 258.5000
0.000555 258.7500
0.000592 258.2500
0.000629 258.5000
0.000666 259.0000
0.000703 259.0000
0.000740 259.0000
0.000777 259.0000
0.000814 259.0000
0.000851 258.5000
0.000888 259.0000
0.000925 258.7500
0.000962 259.0000
0.000999 258.5000
0.001036 258.7500
0.001073 258.7500
0.001110 258.7500
0.001147 259.0000

Weighed data:
0.000000 20.6600
0.000037 23.1364
0.000074 30.3167
0.000111 41.9118
0.000148 57.7207
0.000185 76.6909
0.000222 98.2919
0.000259 121.8189
0.000296 145.8943
0.000333 169.7227
0.000370 192.1429
0.000407 212.3755
0.000444 230.2584
0.000481 243.5586
0.000518 253.0467
0.000555 258.1393
0.000592 257.6405
0.000629 253.0467
0.000666 244.0297
0.000703 230.2584
0.000740 212.7863
0.000777 192.3286
0.000814 169.7227
0.000851 145.6127
0.000888 121.8189
0.000925 98.3870
0.000962 76.8392
0.000999 57.6649
0.001036 42.0336
0.001073 30.3460
0.001110 23.1364
0.001147 20.7200

Computed Real values:
0.000000 4352.0577
1.000000 ovf
2.000000 ovf
3.000000 ovf
4.000000 ovf
5.000000 ovf
6.000000 ovf
7.000000 ovf
8.000000 ovf
9.000000 ovf
10.000000 ovf
11.000000 1147857230.5007
12.000000 ovf
13.000000 ovf
14.000000 ovf
15.000000 ovf
16.000000 0.6206
17.000000 ovf
18.000000 ovf
19.000000 ovf
20.000000 ovf
21.000000 -1147857229.2202
22.000000 ovf
23.000000 ovf
24.000000 ovf
25.000000 ovf
26.000000 ovf
27.000000 ovf
28.000000 ovf
29.000000 ovf
30.000000 ovf
31.000000 ovf

Computed Imaginary values:
0.000000 -0.0285
1.000000 ovf
2.000000 ovf
3.000000 ovf
4.000000 ovf
5.000000 ovf
6.000000 ovf
7.000000 ovf
8.000000 ovf
9.000000 ovf
10.000000 ovf
11.000000 ovf
12.000000 ovf
13.000000 ovf
14.000000 ovf
15.000000 ovf
16.000000 -309.7014
17.000000 ovf
18.000000 ovf
19.000000 ovf
20.000000 ovf
21.000000 ovf
22.000000 ovf
23.000000 ovf
24.000000 ovf
25.000000 ovf
26.000000 ovf
27.000000 ovf
28.000000 ovf
29.000000 ovf
30.000000 ovf
31.000000 ovf

Computed magnitudes:
0.000000Hz 4352.0577
844.594604Hz ovf
1689.189209Hz ovf
2533.783813Hz ovf
3378.378418Hz ovf
4222.973022Hz ovf
5067.567627Hz ovf
5912.162231Hz ovf
6756.756836Hz ovf
7601.351440Hz ovf
8445.946045Hz ovf
9290.540649Hz ovf
10135.135254Hz ovf
10979.729858Hz ovf
11824.324463Hz ovf
12668.919067Hz ovf

  • Part 2 - After a minute

Data:
0.000000 261.0000
0.000037 261.0000
0.000074 261.2500
0.000111 260.7500
0.000148 260.5000
0.000185 261.0000
0.000222 260.2500
0.000259 261.2500
0.000296 260.7500
0.000333 261.5000
0.000370 261.0000
0.000407 261.5000
0.000444 261.0000
0.000481 260.7500
0.000518 260.5000
0.000555 260.5000
0.000592 261.0000
0.000629 260.0000
0.000666 261.0000
0.000703 260.5000
0.000740 261.0000
0.000777 260.7500
0.000814 261.2500
0.000851 261.2500
0.000888 260.5000
0.000925 261.2500
0.000962 260.0000
0.000999 261.0000
0.001036 260.0000
0.001073 260.0000
0.001110 261.0000
0.001147 260.5000

Weighed data:
0.000000 20.8800
0.000037 23.3376
0.000074 30.6392
0.000111 42.3585
0.000148 58.1111
0.000185 77.4326
0.000222 98.9574
0.000259 122.8772
0.000296 146.8801
0.000333 171.3610
0.000370 193.8137
0.000407 214.8402
0.000444 232.0365
0.000481 245.6785
0.000518 255.0045
0.000555 259.8852
0.000592 260.3840
0.000629 254.5151
0.000666 245.9141
0.000703 231.5920
0.000740 214.4294
0.000777 193.6281
0.000814 171.1972
0.000851 147.1618
0.000888 122.5244
0.000925 99.3376
0.000962 77.1359
0.000999 58.2226
0.001036 42.2367
0.001073 30.4926
0.001110 23.3376
0.001147 20.8400

Computed Real values:
0.000000 nan
1.000000 nan
2.000000 nan
3.000000 nan
4.000000 nan
5.000000 nan
6.000000 nan
7.000000 nan
8.000000 nan
9.000000 nan
10.000000 nan
11.000000 nan
12.000000 nan
13.000000 nan
14.000000 nan
15.000000 nan
16.000000 nan
17.000000 nan
18.000000 nan
19.000000 nan
20.000000 nan
21.000000 nan
22.000000 nan
23.000000 nan
24.000000 nan
25.000000 nan
26.000000 nan
27.000000 nan
28.000000 nan
29.000000 nan
30.000000 nan
31.000000 nan

Computed Imaginary values:
0.000000 nan
1.000000 nan
2.000000 nan
3.000000 nan
4.000000 nan
5.000000 nan
6.000000 nan
7.000000 nan
8.000000 nan
9.000000 nan
10.000000 nan
11.000000 nan
12.000000 nan
13.000000 nan
14.000000 nan
15.000000 nan
16.000000 nan
17.000000 nan
18.000000 nan
19.000000 nan
20.000000 nan
21.000000 nan
22.000000 nan
23.000000 nan
24.000000 nan
25.000000 nan
26.000000 nan
27.000000 nan
28.000000 nan
29.000000 nan
30.000000 nan
31.000000 nan

Computed magnitudes:
0.000000Hz nan
844.594604Hz nan
1689.189209Hz nan
2533.783813Hz nan
3378.378418Hz nan
4222.973022Hz nan
5067.567627Hz nan
5912.162231Hz nan
6756.756836Hz nan
7601.351440Hz nan
8445.946045Hz nan
9290.540649Hz nan
10135.135254Hz nan
10979.729858Hz nan
11824.324463Hz nan
12668.919067Hz nan

Detecting wrong major Peak values at low frequencies

Hello,

Thanks for the good work. Of course the FFT is an approximation with a couple of error sources. Here I have a problem to detect low fundamental frequencies.

I am sampling a sinusoidal signal from a function generator at Fs = 16 KHz. When the signal frequency is under approximately 500 Hz, the result of the majorPeak() computation are wrong. The lower limit of the frequency detection depends on the window used.
So I tested all the windows with frequencies 100, 150, 200, 250, 300, 400, 500, 600, 1000, 2000, 5000, 10000 and 15000 Hz

I am using the dev branch and arrays of float values.

Results:

Windowing Lower limit Hz Precision above the limit
Without 250 worse
Rectangle 250 worse
Hamming 400 good
Hann 400 best of all
Triangle 400 average
Nuttall 600 average
Blackman 600 average
Blackman Nuttall 600 average
Blackman Harris 600 average
Flt top 600 over estimated
Welch 600 average

My problem is that I don't know how to eliminate a result that would be wrong when the signal is under the lower limit. For example it is a 100 Hz signal and I get inconsistent and wrong values in the Khz range.

How could we check if the result is wrong? Is there a way to study the spectre to detect this? Or another way to cope with this?

Usage of multiple FFT's using the same code

Hello,

I have written a code that reads two signals from two ADC. One signal is captured for 4096 samples and another signal is captured for 512 samples. I am sampling both the signals at 500 Hz.

I initially compute FFT for the signal with 4096 samples and find out the peak frequency. This works perfectly.

When I compute the FFT for the second signal, it gives me random values. I have created separate objects for both the FFT's. Kindly let me know if this is possible or should I destruct the first FFT before running the second one. If that's the case, kindly let me know the syntax for the destruct function.

Issues running on Arduino MKR1010 if Serial is not awaited

All of the example scripts won't work on an Arduino MKR1010 unless the following change is made:

  Serial.begin(115200);
  while(!Serial); // <--- This line was added
  Serial.println("Ready");

I haven't tested on the Arduino Uno but I'm assuming that the script works on that.

The calculated peak frequency is half the actual signal frequency.

I use the FFT to analyze the sound spectrum on ESP32. Sampling frequency of 40000 Hz, the number of samples is 512. I use the sound signal to calibrate and verify the operation. In doing so, I get the calculated peak frequency half that of the actual signal frequency. The spectrogram looks like a signal with half the frequency.

Change request double type to float

Thanks for this great library. I am now using it on STM32 and the double type is 64 bits so it takes a lot of memory when using the actual "double" type that is used everywhere.

I changed them to float. This is much more convenient and does not visibly reduce the precision. For usual Arduino boards like the UNO float and double datatypes are equivalent 32 bits data.

Finding real amplitude from computed magnitude

Hello Enrique,

I'm not a math expert, i'm just trying to use as best as i can your neat library. i have seen in the examples that computed magnitude in the Freq/Magnitude is not the real amplitude of the signal in the Time/Amplitude domain. I have seen here and there that to find the real amplitude from the magnitude with a FFT at a given Frequency, it's possible to divide by N or Sqrt(N). N is the number of samples used to compute the FFT. By the way, even if it works sometimes, it doesn't work everytime.

For example, Actually, i'm working on a project with an ESP32 and an ADXL337 (accelerometer), which purpose is to detect vibration frequency and amplitude on mechanical devices.

ADXL337 sensitivity is -3G/3G on 3 axis, with a linear response. From what i have seen, max sampling rate is 1600Hz on X&Y and 550Hz on Z. which let me work in the frequency range 0->800Hz on X&Y and 0-275Hz for Z.

I'm using only X axis for testing. I'm sampling at 512Hz and i'm using 1024 samples (which means that my acquisition lasts 2s, but no problem, because i don't need real time).

Shaking the ADXL337 by hand, i can actually achieve easily 5/6 hz Freq. The result of the FFT is nice for the frequency, which gives me a huge peak at 5.5 hz.

Here are the results graphed in a Google sheet for better understanding :

Click here to see the graphs

Someone can say that i have checked the ADXL337 to strongly, I went beyond the limits of the accelerometer. But i don't think it has a big impact on magnitude (maybe i'm wrong also...).

On the ESP32 the range of the ADC is 0-4095, with no negative value (of course). Using ArduinoFFT i have an amplitude of 613881 at 5.5Hz

I'm wondering, how can i find what was the amplitude in the Time/Amplitude domain at 5.5hz from this value. it's probably around 4095. Is there some mathematical relationship or should i find this relationship with some calibration samples ?

Thx for your help
Cédric

Is it possible to list all the frequencies?

Hi,
First of all, it's not an issue, it's a question.
Secondly please forgive me if I am posting at wrong place. I've been reading for a week now and came to conclusion that FFT is the only solution to my problem, but not sure how to achieve the following.

I am using MEMS microphone + ESP32 and want to detect all the frequencies in a room along with pitch and tone.

Actually purpose is to figure out if there is a party going on in an apartment. and I was told that I would need to look at following 4 properties to figure out.

  1. Decibels
  2. Frequencies
  3. Pitch
  4. Tone

please help me out.

Thanks

Multiple Peaks from FFT

Hello there!

I am using this neat library for FFT Calculations on vibration signals acquired from an accelerometer. I wanted to know if there is any way to calculate peaks,other than the major peak(e.g 2nd-3rd highest peak).

Best regards,
Thomas

Can one do FFT only for some of the spectrum?

@kosme I appreciate your work. I have a question.
How can I only sample a portion of the frequencies? If I am only interested in 500Hz to 1kHz (example), can I then have faster processing, and smaller bin width? I think it is too much processing to do the whole spectrum in my project.
Can FFT be made faster, more fine-grained, if it only looks at a subset of the whole? If so, any ideas on how?
Thanks!

Compatibility with ARM Mbed Compiler?

Hello,

I intend to use this library with the FRDM K64F on the ARM Mbed Online Compiler. I wanted to inquire whether I can use this library as it is, or will I have to make any changes to the existing library.

Thank you!

FFT_01 Example

Hi there,
I'm a beginner with Arduino and github but I tried implementing your FFT_01 example on an Arduino M0. It worked fine initially. I then tried setting the code to run in a loop by commenting out the while(1) condition and uncommenting the delay(2000) condition. I have noticed that for some reason the first loop iteration calculates the frequency correctly but subsequent iterations produce the same incorrect result. I have not changed anything else about the code other than changing Serial.xxxx into SerialUSB.xxxx functions so it is compatible with the Arduino M0.
Could you please advise me if I am using the code incorrectly or if there is some issue
Thanks!!

would like latest code in a 'release'

Great library. I am using the ArduinoFFT library in a PlatformIO project. PlatformIO will only load releases. If the latest code is stable, it would help me if it were marked as a release (1.5 or 1.4.??). Thank you.

Usual frequencys

Hello,
How can i get adc in octav band freqency?
(16-32-63-125-250-500-1000-2000-4000-8000-16000Hz)

MEMS + ESP32 + FFT

Hello,
I am trying to use SPH0645 MEMS microphone with ESP32, but what I get on the output is just the wrong number.

Here is the code that I am using:

#include <WiFi.h>
#include "driver/i2s.h"
#include <arduinoFFT.h>
arduinoFFT FFT = arduinoFFT(); /* Create FFT object */

const int BLOCK_SIZE = 1024;
const double samplingFrequency = 10000;
double vReal[BLOCK_SIZE];
double vImag[BLOCK_SIZE];
int32_t samples[BLOCK_SIZE];

i2s_config_t i2s_config = {
mode: (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
  sample_rate: 44100,
bits_per_sample: I2S_BITS_PER_SAMPLE_32BIT,
channel_format: I2S_CHANNEL_FMT_ONLY_LEFT,
communication_format: (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB),
intr_alloc_flags: ESP_INTR_FLAG_LEVEL1,
  dma_buf_count: 8,
dma_buf_len : BLOCK_SIZE
};

i2s_pin_config_t pin_config = {
  .bck_io_num = 5, //this is BCK pin
  .ws_io_num = 18, // this is LRCK pin
  .data_out_num = I2S_PIN_NO_CHANGE, // this is DATA output pin
  .data_in_num = 4   //DATA IN
};
const int i2s_num = 0;
int retStat = 0;
int32_t sampleIn = 0;

void setup()
{
  Serial.begin(115200);
  WiFi.mode(WIFI_OFF);
  //Set up pin 19 for data IN from the Mic to the esp32
  pinMode(4, INPUT);
  //Set up pin 21 and 25 as the BCK and LRCK pins
  pinMode(18, OUTPUT);
  pinMode(5, OUTPUT);
  //Init the i2s device
  i2s_driver_install((i2s_port_t)i2s_num, &i2s_config, 0, NULL);
  i2s_set_pin((i2s_port_t)i2s_num, &pin_config);
  i2s_start((i2s_port_t)i2s_num);
  //This pulls in a bunch of samples and does nothing, its just used to settle the mics output
  for (retStat = 0; retStat < BLOCK_SIZE * 2; retStat++)
  {
    i2s_pop_sample((i2s_port_t)i2s_num, (char*)&sampleIn, portMAX_DELAY);
    delay(1);
  }
}

void loop()
{
  sampleIn = 0;
  for (uint16_t i = 0; i < BLOCK_SIZE; i++)
  {
    //this reads 32bits as 4 chars into a 32bit INT variable
    i2s_pop_sample((i2s_port_t)i2s_num, (char*)&sampleIn, portMAX_DELAY);
    //this pushes out all the unwanted bits as we only need right channel data.
    sampleIn >>= 14;
    vReal[i] = sampleIn;
    vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows
  }
  FFT.Windowing(vReal, BLOCK_SIZE, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
  FFT.Compute(vReal, vImag, BLOCK_SIZE, FFT_FORWARD);
  FFT.ComplexToMagnitude(vReal, vImag, BLOCK_SIZE);
  double x;
  double v;
  FFT.MajorPeak(vReal, BLOCK_SIZE, samplingFrequency, &x, &v);
  Serial.print(x, 6);
  Serial.print(", ");
  Serial.println(v, 6);
  delay(2000);
}

Simulated waveform little bug

I think there is a little error in the examples. When creating a synthetic wave

double cycles = (((samples-1) * signalFrequency) / samplingFrequency); //Number of signal cycles that the sampling will read

should be:
float cycles = (((samples) * signalFrequency) / samplingFrequency); //Number of signal cycles that the sampling will read

The duration of the sampling is indeed = samples / samplingFrequency either you index them from 0 or 1.

Need new method

I need a new method e.g. void MajorPeak(double & f, double & v);

which returns not only the peak interpolated frequency but also the peak interpolated value...

can you add something like this ?

the reason is that to calculate the sea wave height :

sea wave height = Elevation spectrum Sz(f) = acceleration spectrum Sa(f) / (2pif)^4

using the double MajorPeak(); I get the f but to get the acceleration spectrum Sa(f) I need the interpolated value also...

if I'm not mistaken btw :)

Major peak vs Magnitude data

Hi there,

I'm trying to use the library to sample real-time measurements from a DC current sensor. The piece of code responsible for that is the following:

for (uint16_t i = 0; i < samples; i++)
{
current_mA = ina219.getCurrent_mA();
vReal[i] = uint8_t(current_mA);
vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows
}
/* Print the results of the simulated sampling according to time /
Serial.println("Data:");
PrintVector(vReal, samples, SCL_TIME);
FFT.Windowing(vReal, samples, FFT_WIN_TYP_HANN, FFT_FORWARD); /
Weigh data /
Serial.println("Weighed data:");
PrintVector(vReal, samples, SCL_TIME);
FFT.Compute(vReal, vImag, samples, FFT_FORWARD); /
Compute FFT /
Serial.println("Computed Real values:");
PrintVector(vReal, samples, SCL_INDEX);
// Serial.println("Computed Imaginary values:");
// PrintVector(vImag, samples, SCL_INDEX);
FFT.ComplexToMagnitude(vReal, vImag, samples); /
Compute magnitudes */
Serial.println("Computed magnitudes:");
PrintVector(vReal, (samples >> 1), SCL_FREQUENCY);
majPeak = FFT.MajorPeak(vReal, samples, samplingFrequency);
Serial.print("Major Peak: ");
Serial.println(majPeak, 6);

samples are set to 64 and sampling frequency to 2000.
Q1: is sampling frequency measured in Hz in this code? So in my example is it 2kHz?
Q2: is my code correct for sampling the data from the in219 sensor?
Q3: when I print out the results I get the following measurements:

> [13:07:10:063] Computed magnitudes:

[13:07:10:069] 0.000000Hz 3331.2492
[13:07:10:074] 31.250000Hz 1438.9001
[13:07:10:079] 62.500000Hz 32.3680
[13:07:10:079] 93.750000Hz 43.3368
[13:07:10:085] 125.000000Hz 9.0984
[13:07:10:091] 156.250000Hz 72.3520
[13:07:10:091] 187.500000Hz 101.3240
[13:07:10:096] 218.750000Hz 21.6699
[13:07:10:101] 250.000000Hz 64.0806
[13:07:10:101] 281.250000Hz 41.0935
[13:07:10:107] 312.500000Hz 23.0520
[13:07:10:112] 343.750000Hz 12.0868
[13:07:10:112] 375.000000Hz 27.2012
[13:07:10:118] 406.250000Hz 16.8139
[13:07:10:124] 437.500000Hz 45.7704
[13:07:10:124] 468.750000Hz 42.1793
[13:07:10:129] 500.000000Hz 4.8751
[13:07:10:135] 531.250000Hz 25.4468
[13:07:10:135] 562.500000Hz 16.2070
[13:07:10:141] 593.750000Hz 7.6919
[13:07:10:146] 625.000000Hz 16.9842
[13:07:10:146] 656.250000Hz 33.2346
[13:07:10:151] 687.500000Hz 30.6472
[13:07:10:157] 718.750000Hz 53.2407
[13:07:10:163] 750.000000Hz 13.5191
[13:07:10:163] 781.250000Hz 37.6957
[13:07:10:169] 812.500000Hz 11.4377
[13:07:10:173] 843.750000Hz 41.6263
[13:07:10:173] 875.000000Hz 41.9199
[13:07:10:179] 906.250000Hz 55.0802
[13:07:10:185] 937.500000Hz 22.7566
[13:07:10:185] 968.750000Hz 48.2572

> [13:07:10:190] Major Peak: 183.070256

Since this is a DC current sensor (so mostly a steady signal with a few fluctuations), it's logical that the algorithm calculates the biggest magnitudes at 0Hz and 31.25Hz. However, what is the meaning of the Major Peak in that case? I would expect it would print the frequency where the biggest magnitude exists, that is 0Hz. Instead it prints "183.07" which seems to be close to the frequency of 187.5Hz, which corresponds to the biggest magnitude excluding 0Hz and 31.5Hz. So what is the meaning of this value?

Your FFTcode just run only one time??

Hi,

I'm so sorry my English is bad,and
May I ask you some question about your arduino code??
Your arduinoFFTcode just run only one time??
I saw the data ,the first data is yes,but The value will accumulate again,until overflow
if I wanted to modified this code to do compute FFT again,and it couldn't accumulated
how can i do ><

Functions to set parameters.

Hello,

I would like to change the settings like the sampling frequency and maybe the number of sample after initializing the FFT object, because I don't know these parameters when declaring the FFT at global scope.

Would it be possible to add these functions:

`void setSamplingFrequency (T samplingFrequency) {
_samplingFrequency = samplingFrequency;
}

void setSamples ( uint_fast16_t samples) {
_samples = samples;
}`

Storage issues with sample sizes over 128

Hello,

Your library works great for sample sizes of 128 and below, but when I try anything above that in order to obtain a better resolution, I have storage issues. The specific error message is:

Global variables use 2278 bytes (111%) of dynamic memory, leaving -230 bytes for local variables. Maximum is 2048 bytes.

I have tried moving the vReal and vImag arrays into the void loop() so they would no longer be considered global variables, but this caused a bunch of other problems (crazy things printing, like backwards question marks, etc.). Do you have any suggestions? Thanks.

software wdt reset occurs every time when using nodemcu esp module

Hi sir ,
I have a nodemcu esp module and i have tried fft using your library . Everytime when comes at the while(1) infinite loop, module goes through a software wdt reset . As I have read in the esp documentation they had specified that a while(1) statement can trigger a wdt reset . I have tried uncommenting while(1) statement which cause frequency keep on iteration and causing overflow .I have just used the example3 in the fft library . I am doing something wrong sir . Can you please help me out?

Understanding the Bit swap function in Compute

The compute method runs a small while loop which shifts 'samples' and modifies j to determine when to run Swap function. I am trying to understand the rationale/theory for this bit of logic. It seems to produce a very random pattern?

Implement Dolph-Chebyshev / taylor window function

In the Dolph-Chebyshev / taylor windowing function sidelobes can be supressed to -20 * a.

The math is a bit more involved then the window functions I added as pull request. It also requires changes to the function parameters as it would be nice to have a as a user definable parameter.

It would also be a good idea to add cosh as an private internal function since Dolph-Chebyshev relies on the cosh function.

I would like to hear what you think about this.

MajorPeak problems

MajorPeak() cannot detect "flat" peaks, where adjacent frequencies have the same value.

The tests should be reordered, so that the test for the maximum peak value is made first, and only if a new peak is found the remaining tests are made. Together with the "flat" problem I'd suggest to find only the major peak position first, and finally compute the frequency from the next lower values at either side of the peak, instead of only [i-1] and [i+1].

dBA values

@kosme So, actually I am using this library to get sound pressure level dBA values in frequency domain.
Is the weighted data calculated in the FFT_03 example A-weighted data? And so the final computed values are in dBA itself?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.