Alexander Kojevnikov | Blog

Faster Fast Fourier Transform

Spek logo Spek is already pretty fast at analyzing audio files and creating their spectrograms. Apparently, it can be made even faster!

A sizable chunk of processing time is spent calculating discrete Fourier transforms of audio samples. In this post I'm going to explore a few DFT libraries and compare their performance to what Spek is currently using.

This won't be a comprehensive overview of all available libraries. I'm going to benchmark only what Spek needs:

The list of candidates is surprisingly short:

The test setup is straightforward (the code is on GitHub in case you're curious):



As expected, djbfft is the slowest, using SIMD instructions does make things faster. I am however surprised how fast the FFTW is compared to avfft (approximately 60% faster!)

Conclusion: Next version of Spek will switch to FFTW.

Published: 2014-08-31

Tags: spek

Spek 0.8.0 Released

Spek logo After more than a year in the baking, a new version of Spek is out!

This release is almost a complete rewrite driven by the switch from GTK+ to wxWidgets to simplify packaging and to improve integration on Windows and Mac OS X. The switch also allowed to make a singe-exe version of Spek on Windows, which was a frequently requested feature.

Spek now allows to change the spectral density range, which is essential when trying to detect lossy transcodes. It also handles the low end of the density better resulting in less noisy spectrograms.

There were also some infrastructure changes: downloads and issues have been moved from Google Code to GitHub, and wiki pages with platform-specific installation instructions have been moved to a single INSTALL file.

Read the changelog for the full list of changes in this release. Download links and installation instructions are available on the Spek homepage, get it while it's hot!

Published: 2012-09-23

Tags: spek

Spek and Lion

Spek and Lion

Spek is now fully compatible with the recently released Mac OS X Lion. The bug that prevented it from starting up is now fixed, thanks to John Ralls and the awesome GTK-OSX project.

Get your copy of Spek today!

Published: 2011-08-17

Tags: spek

Spek 0.7 Released

I'm happy to announce the release of Spek 0.7 – a multi-platform acoustic spectrum analyser.

This version features multi-lingual support and a much better OS X integration. It also includes performance tweaks and many bug fixes.

Read the NEWS file for a full change log.

Download links and installation instructions are on the Spek website, get it while it's hot!

Published: 2011-04-24

Tags: spek gnome

Spek status update

Just a quick update on the status of the project.

Spek is now translatable, the next version will feature at least these translations: Dutch, German, Russian, Swedish and Ukrainian. We use Transifex to manage translations. Feel free to translate it into your language or to improve an existing translation. Transifex is a very easy to use tool, you don't have to know anything about programming to translate.

Some progress has been made on the packaging front, Spek packages are now available in Arch Linux, FreeBSD and Gentoo repositories.

I also created a package for Debian which needs a sponsor. If you are a Debian Developer I would appreciate a review and eventually an upload. The package can be found on

Last but not least, the next version will show some OS X love. Many OS X specific bugs have already been fixed or are scheduled to be fixed for the next release.

I expect to release Spek 0.7 sometime this spring. If you are feeling adventurous, try Spek from git master, compilation instructions are on the wiki.

Published: 2011-03-16

Tags: gnome spek

Spek 0.6 Released

I'm happy to announce the release of Spek 0.6 – a multi-platform acoustic spectrum analyser.

This version is about 3 times faster than 0.5 thanks to the lightning-fast FFmpeg decoders and the new multi-threaded analysis algorithm.

Spek 0.6 also features dramatically reduced size of the Windows installer (from 17.1 MiB to 9.8 MiB) and OS X bundle (from 10.5 MiB to 6.1 MiB)

Read the NEWS file for a complete change log.

Published: 2010-07-13

Tags: spek gnome

GStreamer, FFmpeg and Spek

Next version of Spek will use FFmpeg libraries to decode audio files. There are several reasons for the switch from GStreamer:

GStreamer is a fantastic framework for building complex multimedia pipelines, however what Spek really needs is a simple decoder and FFmpeg's libavformat and libavcodec do just that.

To handle some audio formats (e.g. APE and DTS), GStreamer relies on FFmpeg anyway, so the switch will result in fewer dependencies. It doesn't matter too much on GNU/Linux, but this will reduce the size of the Windows and Mac OS X installers.

Spek used GStreamer's spectrum plugin to perform the actual spectral analysis, with FFmpeg I had to implement it myself. The code I ended up with is very compact and gives room for a lot of experimentation, from using different window functions (it's still Hamming) and working on performance optimisations to switching to a faster FFT library.

The last bit is actually done, Spek now uses FFTW which in my tests is 1.5x to 2x faster than Kiss FFT used by GStreamer. Apart from that, FFTW can scale to multiple threads with near linear performance increase, future versions of Spek will take advantage of this.

UPDATE: As one of commenters pointed out, FFTs on small number of samples are not very parallelisable and my benchmarks confirm this. Also, I switched from FFTW to avfft which is built into FFmpeg. It's a little bit faster than FFTW for my particular use case. Lastly, 1.5x to 2x speed up was actually caused by a faster decoder, not by a faster FFT library.

Another thing that would be hard with GStreamer is static cross-compilation using mingw-cross-env to produce a single Windows executable. Because FFmpeg doesn't employ a plugin architecture, static linking is not an issue.

Last, but not least, the whole experience was very educational. I now remember why I loved C back in the days, the trick is to not even attempt to write any GObject code with it, that's what Vala is for. Fast Fourier Transform and the maths behind it is much fun, and NR was very helpful here.

For the curious, the code is merged to git master and pushed to Gitorious. The next version of Spek will be released sometime in July.

Published: 2010-07-04

Tags: spek gnome

Spek 0.5 - Mac OS X port

I'm happy to announce the release of version 0.5 of Spek, a multi-platform acoustic spectrum analyser.

Spek under OS X

Changes since the previous release:

This is the first version of Spek that features a Mac OS X port. All binaries in the app bundle are compiled completely from scratch using a slightly modified version of Aaron's excellent bockbuild project (the same tool that is used to package Banshee for OS X).

If your project uses the GNOME stack and you want to port it to Mac OS X -- give bockbuild a try. Check Spek's bundle script for gory details.

Published: 2010-06-27

Tags: gnome spek

Spek 0.4 Released

I've just released version 0.4 of Spek -- an acoustic spectrum analyser for GNU/Linux and Windows.

Spek showing a 24-bit FLAC file

This version brings the following features and improvements:

Grab Spek 0.4 while it's hot, the source code tarball and the Windows installer can be downloaded here.

A special "thank you" to users of a popular private tracker, their great suggestions helped to shape this release.

P.S. Hello, Planet GNOME! :)

Published: 2010-05-21

Tags: gnome spek

Spek 0.3 Released

Spek 0.3 is out, just 2 days after the previous release. This version includes the following features and fixes:

Rulers in Spek

Spek 0.3 source code tarball and the Windows installer can be downloaded here.

Published: 2010-05-17

Tags: gnome spek

Page 1 / 2 »