Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Synchronous Waveform Averaging
Synchronous waveform averaging, also called coherent averaging or simply "signal averaging", is a powerful analysis tool that can reveal hidden details in a waveform or its spectrum, information that may have have been completely buried in noise or interference. Unlike other methods, it recovers the true waveform exactly, with no phase shifts or rounding, and it can even remove contaminating signals that are in the same frequency range.
To use this approach, the signal of interest must be repetitive, and you must be able to trigger data acquisition precisely at each repetition. These requirements are easily met by many real-world measurement situations, typically those where the desired signal is the response to a stimulus -- which also provides the trigger.
For example, the Daqarta Generator may be used to produce a tone burst for auditory testing, where the desired signal is the brain-wave response to that stimulus. Or a Generator pulse may actuate a hammer-driving solenoid for a structural impulse test, where the signal of interest is the vibration response of a certain beam.
The trigger signal is provided directly by the stimulus source, and coincides with the start of the stimulus. The response to that stimulus is recorded and added sample-by-sample to sequential positions in a data array. This is called one frame, analogous to one frame on a display screen.
(Previously, this was called a "sweep", after the analogous operation on a conventional analog oscilloscope. There, the display is created by a beam of electrons that sweeps across the screen after each trigger event. Daqarta no longer uses that terminology to avoid confusion with frequency sweeps.)
Each position in the array corresponds to one time point on the waveform display. On the next stimulus trigger, the whole process repeats, adding samples to the same array locations in the same sequence.
If the desired response repeats with exactly the same alignment at each trigger, while noise or other signals do not, then only the desired signal builds up in the buffer and everything else tends to average out to zero. The buffer contents are displayed graphically after normalizing by the number of frames. On a real-time display, the noise seems to melt away and the desired signal gradually appears, like a fuzzy image coming into focus.
Set the Generator Wave type for Stream 0 to Sine, and set its frequency to a few hundred hertz, enough to see several cycles on the trace. (The 440 hertz default is fine.) Set Level to 10%. If you don't see a nice stable trace, go into the Tone Freq dialog and make sure Tone Sync is set.
Next, go to the Averager dialog (CTRL+A or the thin bar under the Averager toggle button at the upper left of the screen). Make sure that Linear is set, Frames is 32, and Artifact limits are set for +/-100%... these are the defaults.
Start an average (ALT+A or the Averager button on the toolbar or the one at the top of the Averager dialog) and watch the fuzziness grow smaller as the Total Frames count (just under the toolbar Averager button) increases.
Now try setting the noise level higher, say to 40% or 80% and repeating the average. (Be sure to keep the total of the two Level settings to 100% or less to avoid clipping). Try doubling the frames request to 64, and quadrupling to 128.
One thing you will notice is that most of the improvement due to averaging comes at the start. In fact, the reduction is proportional to the square root of the number of frames, so in order to reduce the noise by half (-6 dB), you need to quadruple the frames.
The diminishing benefits put a practical limit on averaging, since you eventually get to a point where you don't want to wait around for twice as long just to get the noise reduced by another 30%. (0.707 is the square root of 2.) Even if you are willing to go eat lunch while the averager runs, there are often other limits. When you are working with real-world responses to stimulus signals, you may be limited by the experiment itself: Conditions may deteriorate, a subject may get fidgety, or the phenomenon being studied may not persist.
Averaging is very often the only technique available for extracting a signal that is buried in noise. Averaging makes it possible to record from simple scalp electrodes and see the tiny neural potentials evoked by an acoustic click or tone burst stimulus, where without averaging you would see nothing but noise. The source of the potentials, deep in the brain, must compete with all the other brain activity. But the other activity that is unrelated to the auditory response slowly averages out to zero, and only the auditory evoked potential remains. This allows hearing tests to be given to infants, unresponsive patients, or animals who could not otherwise "raise one finger/paw if you can hear this tone".
You can also use synchronous averaging even when the stimulus is produced by an external source instead of the Daqarta Generator. Typically, you would connect the stimulus source to the Right input and the response to the Left. Set the trigger mode to Normal, and set the Trigger Source to Right In. Then adjust the Trigger Slope and Level while viewing the Right Input until you get reliable triggering at the same point on every stimulus.
At that point you may want to toggle off the Right channel display (but not the Right Input itself) since it won't be very interesting. Since the Left and Right inputs of the sound card are always in sync, when you run the average the Left channel will recover the signal from the noise.
You may want to use this method even if the stimulus is produced by the Generator, if your sound card does not allow the inputs and outputs to be synchronized at the sample rate you want to use, or if you haven't run a calibration yet to find the proper Duplex Delay. See Full-Duplex Techniques for more information.
Note that the trigger point doesn't need to be the start of the stimlus, since you can use negative Trigger Delay to align the display to the start.
External triggering is only useful if the stimulus has some distinct feature that allows reliable triggering. If it does not, you might check to see if there is perhaps another output on the signal source that can provide that sync. For example, if you are using an external frequency sweep as the stimulus, see if there is a separate sweep sync pulse that is generated at the start of the sweep, and if so feed that to Right In instead of the actual stimulus. Or, if you are using an amplitude-modulated sinusoid as the stimulus, you can connect the modulation source to Right In.
In general, however, it's usually simplest and best to use the Daqarta Generator to generate the stimulus wherever possible and use Gen Sync.
If the signal being studied does not result from a stimulus that you generate directly, there may still be ways of getting a trigger. If the signal includes a transient peak that rises well above the noise, you can use Normal trigger mode and set the Slope and Level appropriately. This may be needed when studying spontaneous natural phenomena such as nerve discharges.
CAUTION: If you are triggering on the response and the trigger portion of the signal fades or drops out, you want the averager to stop and wait for a valid trigger. For this reason Auto or Auto Level trigger modes are not recommended for averaging use. In these modes the level could self-adjust so that it triggers on background noise or the wrong portion of the input signal, contaminating the average.
Synchronous waveform averaging should not be confused with "moving average", "boxcar average", or other sorts of "smoothing" functions. Those provide only cosmetic improvement, by averaging together adjacent time-samples . . . the output may indeed look smoother, but such techniques can't tell the signal from the noise. Everything gets smoothed, including the signal itself: Rectangular pulses become rounded hills, and amplitude measurements aren't reliable.
Because true waveform averaging recovers the actual time waveform, it can also convey much more useful information than frequency-selective approaches such as spectrum analysis . . . and you are still free to view the spectrum of the resultant waveform if you choose, with the benefit of a correspondingly lower noise floor.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2022 by Interstellar Research
All rights reserved