Package: qdft
Constant-Q Sliding DFT in C++ and Python (QDFT)Forward and inverse Constant-Q Sliding DFT according to[1]with following features:Arbitrary octave resolution (quarter toneby default)Built-in parameterizable cosine family window (Hann by default)Customizable time and frequency domain data type in C++Endless single or multiple sample processing at onceOptional analysis latency control parameterReal-time analysis and synthesis capabilityThe Constant-Q Sliding Discrete Fourier Transform (QDFT) is a recursive approach to compute the Fourier transform sample by sample. This is an efficient implementation without the FFT calculus. Just define an arbitrary frequency range and octave resolution to obtain the corresponding DFT estimate. In contrast to the linearSDFT, frequency bins of the QDFT are logarithmically spaced. Thus, both high and low frequencies are resolved with the same quality, which is particularly useful for audio analysis. Based on the QDFT, a chromagram feature with detailed instantaneous frequency estimation is planned for the future release.WIPReadmeDocstringsPyPI packageqdftSlidingchromagramas a bonus (a draft is already included in the Python package)Basic usageC++#include<qdft/qdft.h>// see also src/cpp folderdoublesr=44100;// sample rate in hertzstd::pair<double,double>bw={50,sr/2};// lowest and highest frequency in hertz to be resolveddoubler=24;// octave resolution, e.g. number of DFT bins per octaveQDFT<float,double>qdft(sr,bw,r);// create qdft plan for custom time and frequency domain data typessize_tn=...;// number of samplessize_tm=qdft.size();// number of dft binsfloat*x=...;// analysis samples of shape (n)float*y=...;// synthesis samples of shape (n)std::complex<double>*dft=...;// dft matrix of shape (n, m)qdft.qdft(n,x,dft);// extract dft matrix from input samplesqdft.iqdft(n,dft,y);// synthesize output samples from dft matrixThe time domain data type defaults tofloatand the frequency domain data type todouble.PythonfromqdftimportQDFT# see also src/python foldersr=44100# sample rate in hertzbw=(50,sr/2)# lowest and highest frequency in hertz to be resolvedr=24# octave resolution, e.g. number of DFT bins per octaveqdft=QDFT(sr,bw,r)# create qdft plann=...# number of samplesm=qdft.size# number of dft bins (if need to know in advance)x=...# analysis samples of shape (n)dft=qdft.qdft(x)# extract dft matrix of shape (n, m) from input samplesy=qdft.iqdft(dft)# synthesize output samples from dft matrixFeel free to obtain current version fromPyPIby executingpip install qdft.ExamplesQDFTChroma12face.pycmajor.pySee alsoIf you're interested in Sliding DFT withlinearfrequency resolution, don't forget to browse myjurihock/sdftproject!ReferencesRussell Bradford et al. (2008). Sliding with a Constant Q. International Conference on Digital Audio Effects.https://www.dafx.de/paper-archive/2008/papers/dafx08_63.pdfRussell Bradford et al. (2005). Sliding is Smoother Than Jumping. International Computer Music Conference Proceedings.http://hdl.handle.net/2027/spo.bbp2372.2005.086Eric Jacobsen and Peter Kootsookos (2007). Fast, Accurate Frequency Estimators. IEEE Signal Processing Magazine.https://ieeexplore.ieee.org/document/4205098Licensegithub.com/jurihock/qdftis licensed under the terms of the MIT license.
For details please refer to the accompanyingLICENSEfile distributed with it.