Fork me on GitHub

Project Notes

#025 a Kiss FFT Example

Test drive the Kiss FFT C library with an example.

Notes

Kiss FFT is an interesting FFT implementation in C. It promises ease-of-use over absolute performance.

To build a project with Kiss FFT, it just needs the core files compiled and linked.

I found a kissfft-example which I’m building here (under MacOS).

It has the core Kiss FFT files included in the repo, and links with the real-optimised version. The Kiss FFT files it uses are:

_kiss_fft_guts.h
kiss_fft.c
kiss_fft.h
kiss_fftr.c
kiss_fftr.h

The kissfft-example comes with sample data and some python utilities for plotting the results. Data files:

File Description
01_Real_Part.txt labview-generated FFT (for comparison)
02_Imagin_Part.txt labview-generated FFT imaginary component (unused)
dump-raw-3.txt Raw data set
test-output.txt Output generated from the FFT

Setting up the Python Environment

I’m using virtualenv, and it needs some special considerations due to restrictions of the matplotlib library using in the python code - see Working with Matplotlib in Virtual environments.

I’m setting my virtual environment path to PYTHONHOME:

$ export PYTHONHOME=$(cd ../../venv; pwd)

Then activating the environment to install requirements:

$ source $PYTHONHOME/bin/activate
(venv)$ pip install -r requirements.txt
(venv)$ deactivate
$

The virtualenv is deactivated before running the examples … they’ll find the virtualenv from the PYTHONHOME environment variable

Running the kissfft-example

There are justa few commands to clone the kissfft-example repo, compile and run the FFT, then fire up the draw-curve.py python script to visualise the results. I’ve put them in a shell script:

$ ./download_and_run

And here’s an example of the output:

draw-curve.png

Credits and References

About LCK#25 CFFT
Project Source on GitHub Return to the Project Catalog

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.

LittleArduinoProjects LittleModelArt More on my blog