1
$\begingroup$

I'm quite new to this field and have a probably rather basic question: Is there an upper bound for the values in a log-magnitude spectrogram generated like this:

log1p(abs(stft(signal) ** 2)

Obviously, the lower bound is 0 but is there also an upper bound (based on window size/hop length of the STFT)?

$\endgroup$
1
  • $\begingroup$ normally you won't need more than 150 dB of range, the difference between upper and lower bounds, but what the actually upper or lower bound is will be determined by your scaling before the logarithm. $\endgroup$ Feb 28, 2020 at 14:36

2 Answers 2

1
$\begingroup$

Let us consider a standard discrete "spectrogram" or short-term Fourier transform with a window $w$ and frames of length $N$. Let $\|x\|_r = (\sum_{n=0}^{N-1}|x_n|^r)^{1/r}$ denote the $r$-norm of $x$ ($r\ge1)$. Then for each frame of $x$, the first windowed Fourier transform is:

$$F(\omega)=\sum_{n=0}^{N-1}x_n w_n e^{-j\omega n}\,.$$

Hence, by the Rogers-Hölder's inequalities, for all $\omega$, and any couple $(p,q)$ such that $\frac{1}{p}+\frac{1}{q}=1$:

$$|F(\omega) |\le \|w\|_p\|x\|_q\,.$$

In particular, for classical positive unit windows, $\sum_{n=0}^{N-1} w_n =1 = \|w\|_1$. Choose $p=1$ and $q=\infty$, and you get (over all frames):

$$|F(\omega) | \le \max_n | x_n|\,.$$

Not the tighest upper bound, but simple enough. And honestly, using Rogers-Hölder was seen a bit of an overkill here, since simply:

$$\left|\sum_{n=0}^{N-1}x_n w_n e^{-j\omega n} \right| \le \sum_{n=0}^{N-1}\left |x_n w_n e^{-j\omega n} \right| \le \max_n | x_n|\sum_{n=0}^{N-1}\left | w_n \right|\,, $$

but for "unit-energy" windows, you will get other estimates with $p=q=2$. You can now plug it inside your "log of one plus" formula.

Similarly, you could find a tighter lower bound.

$\endgroup$
0
$\begingroup$

Depends, is your signal bounded? If not then no, since scaling your signal by an arbitrary scalar factor alpha leads to a scaling of the spectrogram by abs(alpha)^2. Unless there are some limits to the values found in your signal, you need to be prepared for (more or less) arbitrarily large numbers that will also make your spectrogram arbitrarily large.

If you do have a bound on your signal (i.e., some norm of it being $\leq$ some constant) you could work out an upper bound for your spectrogram.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.