Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!

Synchronous Waveform Averaging:

Triggering the Magic Bullet

by Bob Masta
Interstellar Research


Previous Next

Synchronous waveform averaging can provide a "magic bullet" that hits noise without affecting a desired signal, even extracting that signal from below the noise floor. But it only works on repeating waveforms where a synchronous trigger is available. The methods to provide that trigger vary with the type of measurement.

Stimulus Burst Generation:
For the usual stimulus - response situation, the ideal arrangement is for the averager system to produce the stimulus, and simultaneously start each data frame in perfect synchrony. In such cases, no external trigger is required. For example, a tone burst or impulsive waveform can be generated in software and repeatedly sent from memory to a digital-to-analog converter (DAC), whose output is amplified to drive a speaker or other transducer as required.

The sample timing for this process can be controlled by the same internal clock that controls the acquisition of the response data from the analog-to-digital converter, insuring that output and input samples maintain sync throughout the frame. All that is needed is for the software to start both processes on the same clock pulse at the beginning of a frame, and collect the resonse data into a temporary buffer. After the frame, the buffer contents are summed sample-by-sample into the averager array.

Stimulus Pulse Generation:
Alternately, instead of directly generating the stimulus itself, the averager system may simply output a TTL pulse at the start of each frame. That pulse can then be used to produce the actual stimulus by driving a solenoid or other mechanical actuator, triggering a spark discharge, gating an external tone burst generator, or initiating some other process.

Sometimes the pulse may be used directly, or with minimal shaping or filtering, to provide a "click" acoustic stimulus. Since TTL levels are not precisely controlled and may also contain system noise, the pulse may need to be cleaned up by passing it through a simple comparator circuit.

Because a pulse has a broad spectrum, conventional analog filters can be used to control the frequency content. Bandpass-filtered clicks were commonly used by early auditory researchers to measure neural response thresholds at different frequencies. This method has been largely superceded by the above direct-generation technique, but may still be used on legacy systems that lack DAC outputs.

With the pulse-output approach, the averager system starts the acquisition frame at the same time as it starts the pulse. A variant of this approach may be used with certain external stimulus generators, whereby the pulse initiates the stimulus sequence, but the averager waits for a sync pulse from the stimulus source before starting the acquisition frame. This is needed in situations where there may be a variable time lag before the stimulus actually begins.

For example, the pulse may trigger a tone burst generator which acts upon the output of a continuous oscillator. If each tone burst must start at a positive-going zero crossing of the tone, then the burst generator may have to wait for up to one whole cycle of the tone before beginning the burst, and simultaneously giving the sync pulse to start the averager.

This brings up an important point about the use of waveform averaging: The responses being averaged must be repetitive, but they don't have to repeat at any constant rate.

As with the filtered-click approach, direct generation techniques eliminate the need for an external tone burst generator, since the entire burst can be stored in memory and reproduced exactly every time, without any need to sync to other equipment.

Continuous Stimulus Generation:
Many measurements call for a continuous stimulus rather than a series of bursts, and signal averaging is equally effective at removing noise and interference in these situations. Since the stimulus is ongoing, any given period of time can be used as the frame interval, as long as each frame starts at the same relative phase of the stimulus waveform.

As with tone burst generation, the averager system repeatedly sends stimulus data from a waveform buffer to a DAC, but here the buffer must contain an exact integer number of cycles of the stimulus waveform. When the last sample is sent out, the system must seamlessly wrap to the start of the buffer and continue sending out samples. Unlike the burst approach, where the stimulus could be shut off after each frame while the averager processed the acquired data, now the stimulus output must continue as an ongoing background operation.

The averager starts each acquisition frame just as the DAC output starts a cycle of the stimulus waveform, typically at the start of the buffer. There is actually no need for the acquisition frame to match the output buffer size, only for it to always start at the same waveform phase. This could be in any cycle in the buffer.

External Stimulus Sync:
If the stimulus is generated externally, such as via a function generator or arbitrary waveform generator, then a sync signal must be supplied to the averager's external trigger input so it can start each frame at the proper phase. Most signal generators provide a TTL output suitable for this purpose. If not, and the stimulus is a simple waveform, a comparator circuit may be used to create a rectangular TTL sync.

For burst-mode stimuli instead of continuous waves, use a sync output which gives one TTL pulse per burst instead of one per waveform cycle. Similarly, you may want to sync to a modulator or sweep generator instead of the main carrier, depending on the nature of the stimulus.

If the averager can start the acquisition sample clock as soon as it receives the external trigger, this method may be just as stable as internal stimulus generation. More typically, however, the sample clock on most data acquisition boards runs independently, and the best the averager software can do is start collecting data on the next clock after the trigger.

The trigger, and the external stimulus waveform, can start at any point in a sample period, so the acquired data may have a slight trigger jitter. Usually this is not a problem when the sample rate is high relative to details in the response waveform.

Even at its worst, it is most likely to be detectable only as a one-sample-wide step in vertical edges of the response waveform. For example, if exactly half of the frames have the edge in one sample period, and half have it in the next one, the overall average will show the "early" frames as a half-height step, followed by a jump to the full height in the next sample period.


Fig. 1: Effect of Trigger Jitter

Figure 1 simulates this effect for a response consisting of a long pulse, followed by a pulse only a single sample in duration. The "late" trace is identical to the "early" trace, delayed by one sample. The view here is greatly magnified to show the small jitter effect, which is just one sample wide on each edge. The effect on the wide pulse would be much less conspicuous with a more typical display resolution of one sample per pixel.

However, the jitter effect becomes a serious problem with responses that are only one sample wide: Then the average is a single half-height pulse, two samples wide. This is the reason you should keep the sample rate high relative to response features.

Internal Triggering:
In general, you can't trigger an averager from the response signal you are trying to average, since you typically use averaging on signals so noisy you can't get a stable trigger. But there are rare exceptions: If there is a stable, high-level feature in the noisy response waveform, you may be able to trigger on that feature and get reduction of the noise elsewhere in the response.

For example, if an electrode is placed on or near a nerve cell, a spike can be recorded each time the neuron fires. With a good setup, the spike can be large enough to provide an unambiguous event for an ordinary slope/level internal trigger. Averaging many of these responses will then allow observation of lower-level details that are otherwise obscured by noise.

Unlike any of the triggering situations discussed previously, systems that allow this sort of internal triggering can often be used in a "free-run" mode, as opposed to stimulus - response, since they effectively provide their own sync signals.

Conclusion:
Successful use of waveform averaging may require a bit of planning to arrange the proper trigger and/or stimulus generation setup. A little creativity here may go a long way toward a clean, low-noise averager measurement.

To experiment with waveform averaging, you are welcome to download the author's Daqarta for Windows software, which includes a built-in signal (and noise) generator plus extensive averaging and triggering options. You don't even need any external hardware for your initial experiments, since Daqarta can use the direct synthesized signal as the averager input.

All Daqarta features are free to use for 30 days or 30 sessions, after which it becomes a freeware signal generator... with full analysis capabilities. (Only the sound card inputs are ignored.)


Previous Next

Features:

Oscilloscope

Spectrum Analyzer

8-Channel
Signal Generator

(Absolutely FREE!)

Spectrogram

Pitch Tracker

Pitch-to-MIDI

DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Period
    Event
    Spectral Event

    Temperature
    Pressure
    MHz Frequencies

Data Logger

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Automotive

Product test

Contact us about
your application!

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved