Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
The following is from the Daqarta Help system:

# Sound Card Step Response

The Impulse approach to measuring frequency response suffers from the low amount of energy delivered to the system because the pulse is so narrow, often necessitating the synchronous waveform averaging of many responses to bring the desired signal out of the system noise floor.

The Step response approach relies upon some mathematical trickery: The derivative of a step function is an impulse function, so it is perfectly "legal" to apply a step to the system and then take the derivative of the response to get the impulse response, and hence the frequency response. But a step has considerably more energy than a narrow pulse, so the response is much larger.

There's more trickery: Applying a derivative to the waveform is equivalent to tilting the spectrum upward at +6.02 dB per octave. In Y-log Spectrum mode that can be done easily with the Tilt option in the Spectrum Curves dialog. This is a way to get an impulse response with less noise, or with little or no response waveform averaging.

You could generate a 0-100% step using the Pulse Wave option of the Generator, but it's much simpler to use a Square wave that runs between +/-100% of full scale. Best of all, the Square response is boosted by 6 dB since the bipolar Square has twice the effective amplitude of a unipolar Pulse.

The frequency must be set low enough so that the high phase of the square wave will be on for at least the 1024 samples needed for one trace, then off for the same. So at a sample rate of 48000 Hz the frequency must be 48000 / 2048 = 23.4375 Hz or less... use 20 Hz or so to provide a safety factor.

Start out in waveform display mode (Spectrum off) and make sure Trigger is active and set to Normal mode, with Slope set to Positive and Delay set to zero.

The best test arrangement is to send the Left output signal back to the Left Input as well as to the device being tested, and feed the response from the device to the Right Input. (With only Left Out activated on the Generator, the same waveform is applied to both Left and Right output, with individual volume controls. So you can use the Right Out sound card signal to drive the device.)

Adjust both Input levels to make sure the signals are not clipped. Typically, Left In will show an initial peak that gently droops away. (A shallow slope means the sound card has good low-frequency response.)

Set Trigger Source to Left In and set Trigger Level to just below the Left In peak height. The idea is to capture the very start of the peak; if you set Level above the peak, there will be no triggering at all and the trace will roll. On the other hand, if you set Level too low you will see too much of the rise leading up to the peak. The ideal setting should give a waveform that starts one sample before the peak, with the very next sample being the peak itself. Use X-axis eXpand to see the start of the wave in more detail when setting this.

Now toggle Spectrum on and make sure Y-log is active. You will see an initial DC peak that decays at higher frequencies. Hit the Curves button in the Spectrum control dialog to open the Spectrum Curves dialog. Set a +6.02 dB/Octave Tilt for both Input channels, and the falling part of the trace will be boosted toward the DC value. You should see a reasonably flat trace on Left In, though typically with noise and irregularities at the high frequencies, as well as the roll-off due to the sound card anti-alias filter above about 20 kHz. The Right In trace will show the response of the device under test.

If the Left In trace doesn't show the expected anti-alias response, double-check the waveform to make sure that the Trigger is properly adjusted to give one sample (and only one sample) before the peak.

One difference from the Impulse response method is that you can't see the effective "flat" stimulus by looking at the output channel. Without Tilt, there should be a single peak at DC, and nothing everywhere else. That's because as far as the FFT responsible for the spectrum is concerned, you only have a DC signal; it only looks at 1024 samples, and all those are at full-scale (or should be, with proper triggering.)

Important: Never use a Window function when viewing the spectrum of a step response or any other transient event that is completely captured in the 1024 input samples used to create the spectrum. Window functions reduce the initial portion of the response, which will seriously compromise the spectrum of the transient. Use Window functions only for continuous waveforms.

Note that the output stimulus signal is not really a step, due to the fact that the sound card output is AC coupled to block DC. And, even if you produce a true step in some other way (perhaps via a lab-type test oscillator generating a square wave), the sound card input is also AC coupled so the response won't look like a step. (But see DC Measurements And Outputs for ways to get true DC response.) If the device under test is a speaker, it won't be able to create a true step output unless it is driving a sealed chamber and the speaker mechanism (cone, dome, and surround) has no air leaks. But as long as the frequency response of the sound card goes substantially lower than the response of the speaker, there should be no problem. That should be the case with most sound cards, which have responses down to a few Hz.

One problem with the Step response method is that the +6 dB per octave Tilt tends to disproportionally boost the high frequency noise that is naturally present. This may obscure the true response at high frequencies. Synchronous waveform averaging will help to reduce this problem.

The Square Step response is typically about 51 dB stronger than the Impulse response on the same system, so less waveform averaging (if any) may be needed to resolve the low-frequency portion of the response. However, since the Tilt is boosting the high frequency noise, there is progressively less advantage at higher frequencies. You will need to judge the utility of this method for your particular situation.