jmerkt/cqt-analyzer

Some sort of sloping?

mx opened this issue · 2 comments

mx commented

Apologies if this is a dumb question. Is there some sort of sloping applied with this spectrum analyzer? Or is it an inherent property of the Constant Q Transform? Or perhaps I'm just holding it wrong, as it were?

To test the analyzer, I ran a white noise source through it. I saw a pretty distinct dB slope downwards from the highest octave to the lowest octave. I found that pretty puzzling, because white noise ought to have a constant magnitude over time rather than a slope. I confirmed that the noise source was white using two other spectrum analyzers (just FFT based, not CQT). I looked through the source code and couldn't find at first glance anything that would be responsible for this sloping. Am I just "holding it wrong" as they say, possibly not understanding the full properties of the CQT? Or is this an issue with cqt-analyzer?

mx commented

Looking at it with spaced sine waves, everything looks appropriately constant. The low frequencies do take much longer to appear and be stable/constant in the analyzer though. I wonder if it has something to do with the time resolution at the lower frequencies.

Hello and thanks for the input!

The slope with white noise you are observing, to my knowledge, is a property of the Constant Q Transform (CQT).
Looking at the CQT as a collection of logarithmic spaced band-passes, the bandwidth of the these filters increases with frequency. Hence, with rising frequency, they integrate over a bigger absolute frequency range, creating the observed slope.
With sine tones, it behaves differently, because these only contain one distinct frequency and don't sum with increasing bandwidth.

The FFT has a constant bandwidth across all frequency bins and therefore doesn't show the slope.

Future versions of the plugin could contain a parameter to actually apply a slope and observe equal power for white noise, but then its a trade-off observing single sine tones with equal magnitude independent of frequency. Maybe there is a clever way to handle this, but I have to think about it.

As you already guessed, the time resolution at low frequencies is lower, because we need a higher frequency resolution there and sadly can't have both at the same time.