Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
An interesting feature of sound cards is the way they perform anti-alias filtering on input and output signals. This is low-pass filtering, but the cutoff slope is much steeper than could be achieved with reasonable analog filters. A steep cutoff is desirable so it can be moved up close to the Nyquist frequency (half the sample rate, the upper limit for un-aliased signals) to maximize the useful frequency range.
This filtering is done in software, which not only allows a super-steep cutoff, but also allows its frequency to be adjusted for different sample rates. This seems to imply a paradox, since anti-alias filtering is required before the A/D converter, while the signal is still analog, to prevent aliasing in the conversion process.
It turns out that modern sound cards employ delta-sigma A/D conversion, which uses a very simple A/D (typically a single bit!) running at a very high internal sample rate, usually in the MHz range. A simple analog anti-alias filter is used ahead of this, which only has to eliminate signals above half of that MHz sample rate. Then the digitized signal is converted to a higher-resolution (16-bit) format at the lower target sample rate (such as 48000 Hz), with very sharp digital filtering done at the same time.
The reverse process takes place on sound card outputs, where a simple (1-bit) internal D/A runs at MHz frequencies that can be easily filtered out by a simple analog output filter. The digital input to the D/A is manipulated such that the final output exhibits low-pass filtering at just under half the target sample rate.
One consequence of sharp-cutoff digital filtering is that the resulting signal exhibits "Gibbs phenomenon". This looks somewhat like overshoot and ringing from a conventional resonant filter, but note that there is also "pre-ringing" and "pre-overshoot" just before each transition (shown here on a photo from a benchtop high-speed oscilloscope trace):
This is the same phenomenon seen when creating a square wave by adding odd harmonics to a sine wave fundamental, each harmonic having an amplitude that is the reciprocal of its order. Here are the results of adding 1/3 of the 3rd, 1/5 of the 5th, and 1/7 of the 7th harmonics (cumulative) to the fundamental. Adding more 1/N harmonics steepens the sides of the "square" wave and reduces the central ripples, but not the "overshoot" peaks at the ends, which never go below about 9%.
No matter how many odd harmonics in the 1/N series you add, the peaks at the ends remain. To eliminate them requires that the series be tapered to zero after a finite number of terms, instead of just truncating the series after some arbitrary harmonic number. This is "windowing" in the frequency domain in order to improve the time domain, and is exactly analogous to the time domain window functions commonly used to reduce leakage "skirts" or "sidelobes" in the frequency domain.
However, doing the equivalent operations on an anti-aliasing filter would compromise its performance for its intended job... anti-aliasing.
Are these added Gibbs peaks and ripples audible? Look carefully at the photo, and note that the first cycle is only about 50 microseconds long... about 20 kHz, the cutoff frequency of the anti-alias filter. It's true that some people can detect 20 kHz tones, especially young children who have not been exposed to loud sound from the ubiquitous music players that older children enjoy. But those threshold detection tests take place with a silent background, and the 20 kHz tone needs to be fairly loud to be detected at all, since it is in a frequency range where hearing is poor. (Human hearing is best in the low kHz range, degrading rapidly at higher or lower frequencies. That's true even for those young ears.)
Note that the photo illustrates the opposite of a threshold detection test signal: The "background" isn't silence, it's a 2 kHz tone (plus lots of harmonics to make a square wave)... smack in the most sensitive hearing range. The Gibbs "tone" is nearly 15 dB below that at the start of each phase (and rapidly attenuates further still), and its frequency is in the least sensitive range. So even if you could otherwise detect a 20 kHz tone alone, here it will be masked by the much louder-sounding square wave.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved