scipy.signal.ShortTimeFFT can only calculate the canonical dual window (which is utilized in ShortTimeFFT.istft).

PR #2610 provides a new function closest_STFT_dual_window to calculate the closest dual window in a least-squares sense for a given desired window as well as a new method ShortTimeFFT.from_win_equals_dual to determine windows which are equal to their dual window.

The main use cases are the following two topics:

### “Constant OverLap Add” (COLA) condition

The COLA method is traditionally used to invert the STFT (as still done in Matlab to this day). For STFT based filter banks (e.g. discussed here), the overlap-add method

is advantageous over other the ISTFT methods, since it is very efficient to implement.

The main downside is the limited choice of known window/hop combinations.

It can be shown that the COLA condition is equivalent of having a constant dual window, i.e., `all(ShortTimeFFT.dual_win == ShortTimeFFT.dual_win[0])`

. Hence closest_STFT_dual_window can be used to find windows which fulfill the so-called “Constant OverLap Add” (COLA) condition. In consequence closest_STFT_dual_window may be interpreted as a generalization and hence check_cola is declared legacy.

In summary, PR #2610 provides a connection between the COLA method and the dual window based method for the ISTFT.

### STFT as a Unitary transform

If the window and its dual window are equal, the STFT is a unitary transform. This means that the the value of the scalar product, i.e.,`sum(x*y.conj()`

, and hence also the signal energy, i.e.,`sum(abs(x)**2)`

, is preserved. ShortTimeFFT.spectrogram gives a simple example on determining with a cross-spectrogram if two signals are orthogonal. Hence, in this case the cross-spectrogram has an intuitive interpretation.

Any feedback for PR #2610 is very much appriciated!