Non stationary Gabor transform
C C++ CMake
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

libnsgt 0.01

This is an implementation of the 'Nonstationary Gabor transform' (Inversible Constant Q Transform) in C. It supports forward and backward transform of the whole or streamed signal. It currently only does complex to complex transforms with double floating point precision.


The library consists of the files nsgt.h and nsgt.c. To make deployment as easy as possible, the project contains a sln file for Visual Studio 2015 and cmakelists.txt for CLion to compile and execute the added examples.

Usage of the library should be relatively straight forwards, and basic examples are found in the examples folder.


Executing the examples will yield something similar to this:

Test full nsgt
Initialization in 393.626 ms
Forward in 28.885ms, Backwards in 26.427ms, Error: -152.032db

Test nsgt stream (sliCQ)
Initialization in 132.662 ms
Forward in 5.999ms, Backwards in 4.990ms,
Forward in 5.374ms, Backwards in 4.906ms, Error: -152.613db
Forward in 5.254ms, Backwards in 4.995ms, Error: -152.779db
Forward in 5.255ms, Backwards in 4.871ms, Error: -153.877db
Forward in 5.717ms, Backwards in 4.921ms, Error: -152.243db
Forward in 5.305ms, Backwards in 5.449ms, Error: -152.238db
Forward in 5.392ms, Backwards in 5.009ms, Error: -152.481db
Forward in 5.422ms, Backwards in 4.861ms, Error: -152.391db
Forward in 5.220ms, Backwards in 4.856ms, Error: -150.750db

Also the following spectrogram output: Glockenspiel spectrogram, linear scaled Glockenspiel spectrogram, decibel scaled Glockenspiel spectrogram, phon scaled Glockenspiel spectrogram, sone scaled


The papers and original Matlab implementation can be found here:

A Python implementation can be found here:


Roadmap and contributing

The following items need to be addressed:

  • apart from double floating point precision, the library needs to support float and long double precision.
  • real-to-complex forward and complex-to-real backwards tranforms needs to be implemented to save memory and time
  • other fft libraries should be supported, one of them possibly be included to get rid of the dependencies
  • other frequency scalings should be supported (currently only octave)
  • support fftw wisdom and serialization

If you want to contribute, please fork this repository and make a pull request with your changes. It is greatly appreciated.


MIT License

note that FFTW is licensed with GPLv2