Lably
Skip to content

Constant-Q transform

Short-time Fourier transform with variable resolution

  • 5 min read
  • 3 chapters

Explore on Lably

ToursExplore Lably’s 3D tours

The transform can be thought of as a series of filters fk, logarithmically spaced in frequency, with the k-th filter having a spectral width δfk equal to a multiple of the previous filter's width:

δfk=21/n⋅δfk−1=(21/n)k⋅δfmin,

where δfk is the bandwidth of the k-th filter, fmin is the central frequency of the lowest filter, and n is the number of filters per octave.

Calculation

The short-time Fourier transform of x[n] for a frame shifted to sample m is calculated as follows:

X[k,m]=∑n=0N−1W[n−m]x[n]e−j2πkn/N.

Given a data series at sampling frequency fs = 1/T, T being the sampling period of our data, for each frequency bin we can define the following:

  • Filter width, δfk.
  • Q, the "quality factor":
Q=fkδfk.
This is shown below to be the integer number of cycles processed at a center frequency fk. As such, this somewhat defines the time complexity of the transform.
  • Window length for the k-th bin:
N[k]=fsδfk=fsfkQ.
Since fs/fk is the number of samples processed per cycle at frequency fk, Q is the number of integer cycles processed at this central frequency.

The equivalent transform kernel can be found by using the following substitutions:

  • The window length of each bin is now a function of the bin number:
N=N[k]=Qfsfk.
  • The relative power of each bin will decrease at higher frequencies, as these sum over fewer terms. To compensate for this, we normalize by N[k].
  • Any windowing function will be a function of window length, and likewise a function of window number. For example, the equivalent Hamming window would be
W[k,n]=α−(1−α)cos⁡2πnN[k]−1,α=25/46,0⩽n⩽N[k]−1.
  • Our digital frequency, 2πkN, becomes 2πQN[k].

After these modifications, we are left with

X[k]=1N[k]∑n=0N[k]−1W[k,n]x[n]e−j2πQnN[k].

Variable-Q bandwidth calculation

The variable-Q transform is the same as constant-Q transform, but the only difference is the filter Q is variable, hence the name variable-Q transform. The variable-Q transform is useful where time resolution on low frequencies is important. There are ways to calculate the bandwidth of the VQT, one of them using equivalent rectangular bandwidth as a value for VQT bin's bandwidth.

The simplest way to implement a variable-Q transform is add a bandwidth offset called γ like this one:

δfk=(2fk+γ)Q.

This formula can be modified to have extra parameters to adjust sharpness of the transition between constant-Q and constant-bandwidth like this:

δfk=(2fkα+γαα)Q.

with α as a parameter for transition sharpness and where α of 2 is equals to hyperbolic sine frequency scale, in terms of frequency resolution.

Sign in to keep reading

2 more chapters are free with a Lably account.

More in Statistics