8
$\begingroup$

I'm doing some measurements with my sound card, I have one output channel connected to one input channel.

I then send the sound card a unit impulse, i.e. a signal 1 value followed by zeros.

The recorded response is shown below.

I know that the Fourier transform of a Rect function, or LPF, will result in a Sinc function - which is what the response below seems to be. But I'm not quite sure as to the reason for the pre-ringing in the response.

captured unit impuse

$\endgroup$
11
$\begingroup$

Somewhere in the chain between the sound card analog input and the samples that you're plotting, there is certainly a lowpass filter. There is likely an analog anti-aliasing filter before the ADC; in addition, there are likely one or more lowpass filters applied during resampling processes either on the card or in the operating system's audio driver stack (resulting in a stream of samples at the sample rate that you requested).

As you noted, lowpass filters often have an impulse response that resembles a $\text{sinc}$ function. When you excite a linear system with an impulse, the resulting output is just a copy of the system's impulse response (due to the convolution theorem). So, the fact that the observed signal looks like a $\text{sinc}$ function is to be expected. It doesn't sound like this surprised you, either.

However: you did not observe noncausal behavior. If you had, then you should have run immediately to your local patent office. Noncausal systems are not realizable in the real world. Remember the definition: in order for a system's response to be noncausal, its output must lead the input in time. Stated differently, the filter would start outputting its response to the input before you put the input in. Obviously, that's not going to happen.

So what's with the pre-ringing? Simple: the large spike in the middle corresponds to the center of the filter's impulse response. However, that spike does not correspond to $t=0$, the time at which the impulse was inserted into the filter. Consider the following MATLAB example:

% generate a 250th order lowpass filter
b = fir1(250, 0.5);
% plot its impulse response
plot(0:250, b); grid on;

The resulting plot looks like this:

enter image description here

As you can see, the peak in the plot is not at sample index zero. The filter has an overall delay of 125 samples (indeed, all linear-phase FIR filters have a bulk delay of $\frac{N}{2}$ samples, where $N$ is the filter order), and the pre- and post-ringing are centered about that delay. So, when you insert the impulse, you initially see very little response. As the impulse makes its way through the filter taps, the ringing ramps up to a peak at the impulse response's center, then ramps back down to zero.

The takeaway: There is no noncausal behavior in the example you gave. It is possible to simulate noncausal filters in practice by adding enough delay, similar to the delay shown in the lowpass filter's impulse response above.

$\endgroup$
  • $\begingroup$ Haha, I wish it were acausal behavior as then I would exploit it to play the lotto and be rolling in the cash! I'm still having a problem getting the intuition for an analog filter displaying the pre-ringing, with a digital filter I can understand the signal propagating through the taps. $\endgroup$ – Lance Jun 29 '12 at 14:22
  • 3
    $\begingroup$ An analog filter is very much analogous to the digital case. Instead of propagating through taps, you have voltages and currents propagating through capacitors and inductors. Recall that the voltage across a capacitor can't change instantaneously; it ramps exponentially, adding delay to the response seen on the output. Likewise, the current through an inductor can't change instantaneously; it ramps exponentially also. All of these effects interwork inside of an analog filter network to give the overall impulse response that you observe. $\endgroup$ – Jason R Jun 29 '12 at 14:45
  • $\begingroup$ Pre-ringing and this kind of response is still more typical of digital filters, but still I am not surprised of seeing this... It's not uncommon for ADCs and DACs to work internally at a higher sample rate than what they are set to, and do the sample rate conversion in the digital domain. $\endgroup$ – pichenettes Jun 29 '12 at 15:41
  • $\begingroup$ @pichenettes: You're right. It's much easier to design a digital filter that approximates a brick-wall frequency response and therefore has a sinc-like impulse response than it is to make an analog one. Good point. $\endgroup$ – Jason R Jun 29 '12 at 16:45
1
$\begingroup$

The Sinc function represents the transform of a linear phase "brick-wall" low pass filter, with the peak centered at time 0. Most physical low pass filters have a closer resemblance to a minimum phase response with a magnitude response that has less perfect/sharp transitions than a Sinc, and with the peak in the minimum phase response offset in time by some physical propagation delay.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.