Main Content

iscola

Determine whether window-overlap combination is COLA compliant

Description

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.

example

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.

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

example

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

Method of overlap-add, specified as:

  • '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.

More About

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.

Recall that the STFT of a signal is computed by sliding an analysis window g(n) of length M over the signal and calculating the discrete Fourier transform (DFT) of each segment of windowed data. The window hops over the original signal at intervals of R samples, equivalent to L = MR samples of overlap between adjoining segments. The ISTFT is calculated as follows.

x(n)=1/21/2m=Xm(f)ej2πfndf=m=1/21/2Xm(f)ej2πfndf=m=xm(n),

where Xm is the DFT of the windowed data centered about time mR and xm(n)=x(n)g(nmR). The inverse STFT is a perfect reconstruction of the original signal as long as m=ga+1(nmR)=c,n, where c is a nonzero constant and a equals 0 or 1. For more information, see Constant Overlap-Add (COLA) Constraint. This figure depicts the steps in reconstructing the original signal.

Figure shows the sequence from the STFT of a signal to the signal reconstruction via inverse STFT. On top, there is a signal in time domain x(n). Segmentation windowing follows below, partitioning x(n) into segments. Upon applying the Fourier transform to the signal segments, they altogether form the squared of the absolute value of X(f), the time-frequency domain equivalent of x(n). Then, the inverse DFT is applied, showing the reconstructed signal segments. Finally, the bottom of the figure shows the reconstructed signal x hat (n), which coincides with x(n), except in the first and last samples, due to the windowing.

Constant Overlap-Add (COLA) Constraint

To ensure successful reconstruction of nonmodified spectra, the analysis window must satisfy the COLA constraint. In general, if the analysis window satisfies the condition m=ga+1(nmR)=c,n, where c is a nonzero constant and a equals 0 or 1, 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(fk)=0,k=1,2,,R1,fkkR.

    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(f)=0,f12R.

    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 m=ga+1(nmR)=c,n, 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

    k = NxLML

    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.

You can use the stftmag2sig function to obtain an estimate of a signal reconstructed from the magnitude of its STFT.

References

[1] 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.

[2] 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.

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

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019a

See Also

Functions