• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    C
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vanilla single-precision radix-2 FFT for the ESP32.

ESP32 FFT

This provides a vanilla radix-2 FFT out-of-place implementation and a test example.

Author

This code was written by Robin Scheibler during rainy days in October 2017.

Example

#include "fft.h"

...

// Create the FFT config structure
fft_config_t *real_fft_plan = fft_init(NFFT, FFT_REAL, FFT_FORWARD, NULL, NULL);

// Fill array with some data
for (k = 0 ; k < fft_analysis->size ; k++)
  real_fft_plan->input[k] = (float)k;

// Execute transformation
fft_execute(real_fft_plan);

// Now do something with the output
printf("DC component : %f\n", real_fft_plan->output[0]);  // DC is at [0]
for (k = 1 ; k < real_fft_plan->size / 2 ; k++)
  printf("%d-th freq : %f+j%f\n", k, real_fft_plan->output[2*k], real_fft_plan->output[2*k+1]);
printf("Middle component : %f\n", real_fft_plan->output[1]);  // N/2 is real and stored at [1]

// Don't forget to clean up at the end to free all the memory that was allocated
fft_destroy(real_fft_plan)

Documentation

  1. Create the FFT configuration by running fft_init.

     fft_config_t *fft_init(int size, fft_type_t type, fft_direction_t direction, float *input, float *output)
    
     Parameters
     ----------
     size : int
         The FFT size (should be a power of two), if not, returns NULL.
     type : fft_type_t
         The type of FFT, FFT_REAL or FFT_COMPLEX
     direction : fft_direction_t
         The direction, FFT_FORWARD or FFT_BACKWARD (inverse transformation)
     input : float *
         A pointer to a buffer of the correct size. If NULL, a buffer is allocated dynamically
     output : float *
         A pointer to a buffer of the correct size. If NULL, a buffer is allocated dynamically.
    
     Returns
     -------
     A pointer to an `fft_config_t` structure that holds pointers to the buffers and
     all the necessary configuration options.
    
  2. Fill data in the input buffer

  3. Call fft_execute to run the FFT

  4. Use the transformed data located in the output buffer

  5. Possibly free up memory by calling fft_destroy on the configuration structure

Note about Inverse Real FFT

When doing an inverse real FFT, the data in the input buffer is destroyed.

Buffer sizes and data organization

  • For FFT_REAL FFTs (forward as well as backward) of size NFFT, the buffer is of size NFFT. Then, the input data is organized as

      Input  : [ x[0], x[1], x[2], ..., x[NFFT-1] ]
      Output : [ X[0], X[NFFT/2], Re(X[1]), Im(X[1]), ..., Re(X[NFFT/2-1]), Im(X[NFFT/2-1]) ]
    
  • For FFT_COMPLEX of size NFFT, the buffer is of size 2 * NFFT as both real and imaginary parts should be saved.

      Input  : [ Re(x[0]), Im(x[0]), ..., Re(x[NFFT-1]), Im(x[NFFT-1]) ]
      Output : [ Re(X[0]), Im(X[0]), ..., Re(X[NFFT-1]), Im(X[NFFT-1]) ]
    

License

This software is released under the MIT license.

Copyright (c) 2017 Robin Scheibler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Repositories

1

fast_bss_eval

A fast implementation of bss_eval metrics for blind source separation
Python
111
star
2

torchiva

Blind source separation with independent vector analysis family of algorithm in torch
Python
72
star
3

CmdArduino

Simple serial command line prompt for Arduino. Developed by Akiba from @freaklabs
C++
34
star
4

Pomodoro

A custom built timer for the pomodoro technique to be more productive.
Eagle
29
star
5

auxiva-ipa

Fast algorithm for determined blind source separation with update of demixing filters with joint adjustment of the remaining sources.
Python
27
star
6

diffusion-separation

Single channel speech source separation by diffusion process (ICASSP 2023)
Python
26
star
7

2020_interspeech_gmdp

Generalized Minimal Distortion Principle for Blind Source Separation
Python
19
star
8

piva

Performance-oriented implementation of independent vector analysis for blind source separation.
Python
18
star
9

pyramic-dataset

48-Channel Anechoic Audio Recordings of 3D Sources
Python
14
star
10

separake

Echo aware source separation
Jupyter Notebook
13
star
11

doamm

Implementation of algorithms for refinement of direction of arrival estimators by optimization
Python
12
star
12

interspeech2023-moving-iva-samples

Repository containing samples produced by the method proposed in "Multi-channel separation of dynamic speech and sound events" and presented at Interspeech 2023.
HTML
8
star
13

auxiva-iss-dnn

Code to reproduce the results in the paper "Surrogate Source Model Learning for Determined Source Separation"
7
star
14

sdr_medium_rare

Code to reproduce results in the paper "SDR - Medium Rare with Fast Computations"
Python
5
star
15

kurodako

A beaglebone black cape with 8 microphone arrays, as many as an octopus has legs.
4
star
16

bss_speech_dataset

A dataset to test blind source separation algorithms
Python
4
star
17

AudioTools

Audio signal processing toolbox in python.
Python
4
star
18

nerdledger

CLI family accounting sw in Python
Python
4
star
19

timeseries-api

A dead simple API to store measurements taken with IoT devices such as ESP8266 or ESP32.
Python
4
star
20

create_wsj1_2345_db

Collection of scripts to create a dataset of noisy multi-channel reverberant mixtures based on wsj1 and CHiME3 datasets.
Python
4
star
21

jisamm

Code the paper on MM algorithms for joint independent subspace analysis
Python
3
star
22

fakufaku.github.io

My frontpage
JavaScript
3
star
23

moteur

Sketch of a physics engine coded as an exercise back around 2004.
C
3
star
24

beamerthemelausanne

A beamer theme with full screen background images for main and section titles.
TeX
2
star
25

Septimus

A large 7 segment display with step-up DC-DC converter and ATtiny2313 for control.
C
2
star
26

cookiecutter-pyroomacoustics-sim

A cookie cutter to quickly get started with room simulation using pyroomacoustics.
Python
2
star
27

repsimtools

Automating reproducibility of large scale simulations and parameters sweep.
Python
2
star
28

python-samplerate2

Monolithic python wrapper of libsamplerate
C++
1
star
29

cookiecutter-latex-ieeeconf

A cookie cutter for latex manuscript used for IEEE conferences (ICASSP, WASPAA, etc)
TeX
1
star
30

LCDShield

An 8x2 LCD Arduino Shield
1
star
31

graphcoloring_mcmc

Implementation of simulated annealing for the graph coloring problem.
Python
1
star
32

FakuFaku-wp

A wordpress theme for fakufaku
PHP
1
star
33

FakuFakuMath

Custom latex mathematical library
1
star
34

Breathalyzer

Evolution from a badge hacking contest at Hashdays 2012.
Arduino
1
star
35

TokyoTime

An alarm clock, based on the BigTime design from SparkFun, but on steroids.
Arduino
1
star
36

PhatThaiAlert

Your local canteen serves amazing Phat Thai ? They advertise their menu with an RSS feed ? Do not miss your favorite phat thai another time using this automatic Phat Thai alert script!
Python
1
star