Is there a family of windows which is "optimal" in terms of energy above/below a boundary, but with controllable ENBW/bandwidth? By optimal, I mean maximising energy concentration inside some bandwidth $B$ like:

$$\frac{\int_{-B/2}^{B/2} \left|W[f]\right|^2 \, df }{ \int_{-\infty}^{\infty} \left|W[f]\right|^2 \, df}$$

where $W[f]$ is the Fourier of the window $w(t)$.

In the case where I don't care about ENBW, I've had good results using Kaiser. But as $B$ increases, the ENBW gets larger and larger, and I'd like to be able to fix it instead.

Background: I'm currently doing STFT processing using a Kaiser window, with beta chosen based on the overlap interval (a.k.a. oversampling factor for the sub-bands, in the downsampling filter-bank view of the STFT).

My experiments designing maximum-energy-ratio windows numerically produced Kaiser-like windows, just with main lobes slightly wider than the bandwidth. So for my STFTs, I'm using Kaisers, tuned for maximum energy-ratio, and also modified for perfect reconstruction:

Graph showing Kaiser window shape and spectrum chosen for various overlap ratios (marked as "bandwidth")

This works well, and gives me some nice-looking bad-case aliasing performance for each overlap ratio (based on numerical simulations):

Graph of STFT aliasing against overlap factor, based on numerical simulations, showing consistent improvement of about 13dB per additional overlap

However, the ENBW increases as the window gets narrower, and this isn't always suitable. Is there a neat way to get almost-optimal windows (in terms of total energy either side of the boundary) for a given ENBW (or any similar bandwidth metric)?

I know this wouldn't give as good aliasing performance as letting the bandwidth be wider, but amongst all possible windows with a given ENBW, there must still be a window which maximises the energy ratio above/below a specified limit.

[edited for clarity]

  • $\begingroup$ Can you formulate your optimality criteria in a mathematical form? I'm not entirely clear what your metric for goodness is. Depending on what you're looking for I think you may be able to generate "optimal" weighting functions. $\endgroup$ Nov 7, 2021 at 16:00
  • $\begingroup$ @Grapefruit Added an equation. The energy ratio there kind of determines the aliasing produced through STFT manipulations. $\endgroup$
    – cloudfeet
    Nov 8, 2021 at 0:52
  • $\begingroup$ My understanding was the DPSS window is optimum for Time-BW product, and Kaiser did a good job of coming close to that. Most think Gaussian has the best, but that is only if you can truly implement a Gaussian which requires infinite time. Once you truncate it the DPSS is superior. $\endgroup$ Nov 8, 2021 at 3:23
  • $\begingroup$ @Dan I thought the Confined Gaussian was actually optimal for that, but yeah. DPSS and its Kaiser approximation also maximise energy concentration in the main lobe, doing very well at the spectral concentration problem, which is why it's my current solution. I was hoping for something similar which also had controllable ENBW. $\endgroup$
    – cloudfeet
    Nov 8, 2021 at 9:42

1 Answer 1



However, Kaisers with higher beta have increasingly high ENBW, which reduces frequency resolution (meaning I need longer STFT blocks for the same accuracy).

ENBW and Frequency Resolution are very similar metrics; anything with a wider bandwidth will accordingly have reduced resolution for a fixed number of samples (or equivalently a fixed duration $T$). Fundamentally the best frequency resolution achievable in Hz is $1/T$, and that is with a rectangular window (no further windowing). Any windowing done beyond that serves to increase the dynamic range (reduce the sidelobes) at the expense of frequency resolution (which is often the right trade to make, given the sidelobes of a rectangular window kernel only go down at $1/f$).

As far as optimality, my understanding is that the Slepian Window is optimum for main lobe versus sidelobe energy for a given ENBW, and the Kaiser window comes close to that.

The truncated Guassian, Kaiser and Slepian windows all allow for setting the equivalent noise bandwidth (ENBW). Many expect the Gaussian window to have the best time-bandwidth given a true Gaussian does, but the truncating it for practical implementation causes it to not be the best choice for this parameter (since a true Gaussian window would extend to $\pm \infty$). For time-bandwidth product, I believe the best is the Slepian Window (DPSS), and the Kaiser comes very close to achieving the Slepian performance. I generated a plot comparing the Window Kernels (Discrete Time Fourier Transform of the Window) for a consistent number of coefficients (in this case I used $N=101$) where the appropriate window parameter was set to make the resolution bandwidth the same for all cases.

UPDATE: I have since added the "Approximate Confined Gaussian Window" suggested by the OP in the comments for comparison. This window is derived by Sebastian Starosielec and Daniel Hagele in the Sept 2014 paper "Discrete-time windows with minimal RMS bandwidth for given RMS temporal width", and in that paper is provided an "explicit approximate expression for straight forward use" which I implemented in my comparison. This approximation is given as:

$$g_k = G(k) - G(-0.5)\frac{G(k+N)+G(k-N)}{G(-.5+N)+G(-.5-N)}$$

With $G(x)$ as a Gaussian given by:

$$G(x) = \exp\biggl(\frac{-\bigl(x-\frac{N-1}{2}\bigr)^2}{2\sigma^2}\biggr)$$

Window Kernels ENBW=2.53 bins

The ENBW for any window is given by:

$$ENBW = N \frac{\displaystyle\sum_{n=0}^{N-1} {w[n]^2}}{\left(\displaystyle\sum_{n=0}^{N-1} {w[n]}\right)^2}$$

For all four cases, I set the ENBW to be 2.53 bins for an apples to apples comparison, as we can see for the same ENBW how much more sidelobe rejection the Kaiser and Slepian provide compared to the two Gaussian variants. The parameters shown are the normalized parameters passed into the window function in scipy.windows.x (where x is guassian, kaiser and dpss respectively). Closer to the mainlobe the Slepian has better rejection than the Kaiser, and further away the Kaiser prevails. Both are far superiour to the two Gaussians with this case of wider resolution bandwidth as given by the significantly higher sidelobe rejection throughout for the same ENBW.

I then set the ENBW tighter to ENBW for another comparison:

Window Kernels ENBW = 1.6 bins

Where if we zoom in close to the main lobe we see higher selectivity for a given ENBW for both the Kaiser and Slepian compared to the two Gaussians, and close in superior sidelobe rejection, with the Slepian just edging out the Kaiser (as expected):

Main lobe zoom in

And zooming in on the sidelobes we see that the Kaiser eventually outperforms the Slepian in rejection further from the main lobe (which doesn't necessarily make it better), and much further away the Confined Gaussian gets to the lowest noise floor: Side lobe zoom in

And as we increase the number of samples, the higher side-lobe roll-off of the Confined Gaussian window provides a significantly improved stop band rejection further away from the main lobe (all parameters were adjusted to bring the ENBW for each window to 1.6 bins for comparison to above):

501 samples

Zooming in on the main lobe, again we see the superior selectivity of the Slepian and Kaisers for a given ENBW, and we also see the cross-over point where the sidelobes of the Confined Gaussian out-perform the Kaiser and Slepian:

Zoom in 501 samples

As for a time-bandwidth product, I used a metric for this by using the same computation for ENBW performed on the frequency domain samples to get an Equivalent Noise Time Response (ENTR):

Summary of results for N=501:

Window N=501 Parameter ENBW ENTR Product
Gaussian $\sigma=89$ 1.60 147.25 236.12
Kaiser $\beta=7.3$ 1.60 162.65 260.52
Slepian $NW=2.42$ 1.60 162.46 260.00
Confined Gaussian $\sigma=89.9$ 1.60 155.65 249.77

(To do: Add the specific optimization parameter provided by the OP in the updated question for these particular windows - also add time bandwidth using $\sigma_t$ and $\sigma_k$ as used in the referenced paper

  • $\begingroup$ "For time-bandwidth product, the best is the Slepian Window" - I don't believe this is correct. See this figure from the paper introducing the Constrained Gaussian window, which is optimal for time-bandwidth product: researchgate.net/figure/… $\endgroup$
    – cloudfeet
    Nov 8, 2021 at 20:53
  • 1
    $\begingroup$ @cloudfeet thanks for the reference- I will add that case specifically so we can compare! $\endgroup$ Nov 8, 2021 at 20:58
  • $\begingroup$ Also, your first graph shows Sleipan and Kaiser where the main lobe extends to about ±0.06. In terms of energy ratio, they are optimal (or close to optimal) if that is the boundary. However, if the boundary of interest is ±0.1, but we still wish to have an ENBW of 2.53, then you could imagine a window where the first few sidelobes are higher, in exchange for being lower outside the ±0.1 boundary. Does that make sense? $\endgroup$
    – cloudfeet
    Nov 8, 2021 at 21:40
  • 1
    $\begingroup$ Got it- I think I understand—- so the “classical” explanation is using the main lobe first null as your boundary and you suspect that might not hold up if we select other boundaries (and you don’t care about nulls or shape just total energy)- and if that is true, what else might be optimum. Do I follow correctly? $\endgroup$ Nov 8, 2021 at 23:56
  • 1
    $\begingroup$ Yeah, that's it. This is relevant to the STFT use-case in particular, where I want to be able to decrease aliasing by decreasing the interval (calculating spectra more often), and I want to do improve further by changing my window function according to that interval, but I don't want to necessarily reduce the frequency resolution (in the way that using a higher-beta Kaiser would). $\endgroup$
    – cloudfeet
    Nov 9, 2021 at 2:04

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.