Example Code

Overlap and Add in LabVIEW

Code and Documents

Attachment

Download All

Overview

Overlap and add is a very common operation in digital signal processing streaming applications.  It is often the preferred method to process large amounts of data where memory and/or storage devices are constrained and where the overhead of processing samples individually significantly reduces the systems’ performance.

Description

Overlap and Add Operation

The basic principle is as follows.  Assume you have a sampled signal H that is too big to be processed all at once.  First, split H into a series of contiguous blocks containing N elements each such that


h = h1 + h2 + h3 + …


The desired result of applying a Finite Impulse Response (FIR) filter with M taps is given by the convolution operation

f * h = f * (h1 + h2 + h3 + … ) = f * h1 + f * h2 + f * h3 + …


However, the individual convolution operations result in an output filtered sequence of size N + M - 1, composed of a filtered data segment fi concatenated with a transient ti.  The correct filtered ith segment of size N is given by


f * hi = fi + ti-1

Overlap and Add in LabVIEW

The simplest overlap and add implementation is array addition.  However, it is necessary to keep track of the filtered data (size N) and the delayed transient for that segment (size M - 1).  Figure 1 shows an implementation where the Array Shift function is used to save the transient and the feedback node is used to delay it for the next iteration.

Overlap and Add 05.png

Figure 1:  Overlap and Add Implementation


The overlap and add VI can be inserted in a loop to process the data on a frame-by-frame (block-by-block) basis.  The LabVIEW block diagram in Figure 2 shows a filtering operation done on the entire sound data.  The lower branch of the block diagram applies the filter to the entire data set all at once while the For Loop performs the same filtering operation using the overlap and add VI.

Overlap and Add 06.png

Figure 2:  Overlap and Add Program

The results of the LabVIEW block diagram shown in Figure 2 are shown in Figure 3 below.  Notice that the Mean Squared Error is 2.08188E-35.

Overlap and Add 07.png

Figure 3:  Overlap and Add Results

Zooming into the filtered graph shows clear details of the results of processing the entire data set or using overlap and add techniques.  Figure 4 below show the processing methods to be virtually identical.

Overlap and Add 08.png

Figure 4:  Zoomed Filtered Data Sets

Download the Overlap and Add LabVIEW Project

The Overlap and Add v2.zip project contains the cleaned up version of the diagrams demonstrating the benefits of using global variables to obtain a better signal flow representation of the filtering methods.

The original LabVIEW Overlap and Add project includes various implementations based on the same principle discussed in this tutorial.

Steps to Implement or Execute Code

  1. Download the Overlap and Add.zip or Overlap and Add v2.zip project
  2. Unzip the project file
  3. Choose an example from the project
  4. Configure the front panel controls for that example
  5. Run the VI using the Run arrow on the LabVIEW toolbar

Requirements to Run

Software

LabVIEW 8.6 Full Development System or newer

Hardware

N/A

Lalo Perez, Ph.D.
Academic Marketing
Singal Processing | Communications | Image Processing

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors