# iscola

Determine whether window-overlap combination is COLA compliant

Since R2019a

## Syntax

``tf = iscola(window,noverlap)``
``tf = iscola(window,noverlap,method)``
``[tf,m] = iscola(___) ``
``[tf,m,maxDeviation] = iscola(___)``

## Description

example

````tf = iscola(window,noverlap)` checks that the specified window and overlap satisfy the Constant Overlap-Add (COLA) Constraint to ensure that the Inverse Short-Time Fourier Transform results in perfect reconstruction for nonmodified spectra.```
````tf = iscola(window,noverlap,method)` specifies the inversion method to use.```
````[tf,m] = iscola(___) `also returns the median of the COLA summation. You can use these output arguments with any of the previous input syntaxes.```

example

````[tf,m,maxDeviation] = iscola(___)` returns the maximum deviation from the median `m`.```

## Examples

collapse all

Create a periodic root-Hann window of length 120. Test whether the window is COLA compliant with a 50% overlap.

```win = sqrt(hann(120,'periodic')); noverlap = 60;```

Check whether the window is COLA compliant with a 50% overlap.

`tf = iscola(win,noverlap)`
```tf = logical 1 ```

Create a periodic Hamming window of length 256. Set the method of Overlap-Add as `'ola'`.

```window = hamming(256,'periodic'); method = 'ola'; noverlap = 128;```

Test whether the window is COLA compliant with a 50% overlap. Also calculate the median of the COLA summation and the maximum deviation from that summation.

`[tf,m,maxDeviation] = iscola(window,noverlap,method)`
```tf = logical 1 ```
```m = 1.0800 ```
```maxDeviation = 2.2204e-16 ```

## Input Arguments

collapse all

Analysis window, specified as a vector.

Example: `win = bartlett(120)` is a Bartlett window of length 120.

Data Types: `double` | `single`

Number of overlapped samples, specified as a positive integer smaller than the length of `window`.

Data Types: `double` | `single`

• `'wola'` — Weighted Overlap-Add.

• `'ola'` — Overlap-Add.

## Output Arguments

collapse all

COLA compliance, returned as a logical scalar. If the function returns a `1` (true), then the window and overlap length satisfy the COLA constraint.

Median of the COLA summation, returned as a real scalar. If the inputs are COLA compliant, then `m` is equal to the COLA summation constant.

Maximum deviation from the median `m`. If `window` and `noverlap` are COLA compliant, the `maxDeviation` is close to the expected numeric precision error of the COLA summation.

Note

You can conclude strong COLA-compliance if `m = 1` and `maxDeviation` is close to the numeric precision error.

collapse all

### Inverse Short-Time Fourier Transform

The inverse short-time Fourier transform is computed by taking the IFFT of each DFT vector of the STFT and overlap-adding the inverted signals. The ISTFT is calculated as follows:

`$\begin{array}{c}x\left(n\right)=\underset{-1/2}{\overset{1/2}{\int }}\sum _{m=-\infty }^{\infty }{X}_{m}\left(f\right){e}^{j2\pi fn}df\\ =\sum _{m=-\infty }^{\infty }\underset{-1/2}{\overset{1/2}{\int }}{X}_{m}\left(f\right){e}^{j2\pi fn}df\\ =\sum _{m=-\infty }^{\infty }{x}_{m}\left(n\right)\end{array}$`

where $R$ is the hop size between successive DFTs, ${X}_{m}$ is the DFT of the windowed data centered about time $mR$ and ${x}_{m}\left(n\right)=x\left(n\right)\text{ }\text{\hspace{0.17em}}g\left(n-mR\right)$. The inverse STFT is a perfect reconstruction of the original signal as long as $\sum _{m=-\infty }^{\infty }{g}^{a+1}\left(n-mR\right)=c\text{\hspace{0.17em}}\forall n\in ℤ$ where the analysis window $g\left(n\right)$ was used to window the original signal and $c$ is a constant. The following figure depicts the steps followed in reconstructing the original signal. To ensure successful reconstruction of nonmodified spectra, the analysis window must satisfy the COLA constraint. In general, if the analysis window satisfies the condition $\sum _{m=-\infty }^{\infty }{g}^{a+1}\left(n-mR\right)=c\text{\hspace{0.17em}}\forall n\in ℤ$, the window is considered to be COLA-compliant. Additionally, COLA compliance can be described as either weak or strong.

• Weak COLA compliance implies that the Fourier transform of the analysis window has zeros at frame-rate harmonics such that

`$G\left({f}_{k}\right)=0,\text{ }\text{ }k=1,2,\dots ,R-1,\text{ }\text{ }{f}_{k}\triangleq \frac{k}{R}.$`

Alias cancellation is disturbed by spectral modifications. Weak COLA relies on alias cancellation in the frequency domain. Therefore, perfect reconstruction is possible using weakly COLA-compliant windows as long as the signal has not undergone any spectral modifications.

• For strong COLA compliance, the Fourier transform of the window must be bandlimited consistently with downsampling by the frame rate such that

`$G\left(f\right)=0,\text{ }\text{ }f\ge \frac{1}{2R}.$`

This equation shows that no aliasing is allowed by the strong COLA constraint. Additionally, for strong COLA compliance, the value of the constant $c$ must equal 1. In general, if the short-time spectrum is modified in any way, a stronger COLA compliant window is preferred.

You can use the `iscola` function to check for weak COLA compliance. The number of summations used to check COLA compliance is dictated by the window length and hop size. In general, it is common to use $a=1$ in $\sum _{m=-\infty }^{\infty }{g}^{a+1}\left(n-mR\right)=c\text{\hspace{0.17em}}\forall n\in ℤ$ for weighted overlap-add (WOLA), and $a=0$ for overlap-add (OLA). By default, `istft` uses the WOLA method, by applying a synthesis window before performing the overlap-add method.

In general, the synthesis window is the same as the analysis window. You can construct useful WOLA windows by taking the square root of a strong OLA window. You can use this method for all nonnegative OLA windows. For example, the root-Hann window is a good example of a WOLA window.

### Perfect Reconstruction

In general, computing the STFT of an input signal and inverting it does not result in perfect reconstruction. If you want the output of ISTFT to match the original input signal as closely as possible, the signal and the window must satisfy the following conditions:

• Input size — If you invert the output of `stft` using `istft` and want the result to be the same length as the input signal `x`, the value of

must be an integer. In the equation, Nx is the length of the signal, M is the length of the window, and L is the overlap length.

• COLA compliance — Use COLA-compliant windows, assuming that you have not modified the short-time Fourier transform of the signal.

• Padding — If the length of the input signal is such that the value of k is not an integer, zero-pad the signal before computing the short-time Fourier transform. Remove the extra zeros after inverting the signal.

 Allen, J. B. "Short Term Spectral Analysis, Synthesis, and Modification by Discrete Fourier Transform." IEEE Transactions on Acoustics, Speech and Signal Processing. Vol. 25, Number 3, June 1977, pp. 235–238.

 Griffin, Daniel W., and Jae S. Lim. "Signal Estimation from Modified Short-Time Fourier Transform." IEEE Transactions on Acoustics, Speech and Signal Processing. Vol. 32, Number 2, April 1984, pp. 236–243.

 Sharpe, Bruce. Invertibility of Overlap-Add Processing. https://gauss256.github.io/blog/cola.html, accessed July 2019.

 Smith, Julius Orion. Spectral Audio Signal Processing. https://ccrma.stanford.edu/~jos/sasp/, online book, 2011 edition, accessed Nov 2018.