Wednesday, March 13, 2019

Deconvolving the measurement system from the system response


I'm preforming a system identification measurement, and would like to deconvolve the measurement system's response from the measured response.


The set up of the system is as follows; the signal is generated on a PC, the signal is then sent to the sound card, which in turn forwards the signal to the power amplifier, this drives a loudspeaker. The loudspeaker propagates the sound energy which is captured by a microphone, and back into the sound card. The recorded signal is then processed by the computer.


The signal from the sound card is also fed straight back to itself, which allows me to measure the response of the pc -> DAC -> ADC -> pc response.


I'd like to deconvolve this 'measurement chain' from the overall 'system chain'. What methods could I use for this task?



Answer



Sorry for the long winded answer, but making a good acoustic measurement is hard. Here are some of the steps involved (and at some point, we'll actually get to the direct answer of your question).


First, you have to make sure that the system you are measuring is actual linear and time invariant (otherwise you can't deconvolve). This can be tricky on a PC if you use regular sound card drivers. These will route any signals through the Windows Kernel Mixer which frequently applies sample rate conversion and yanks buffers around in time in non- deterministic ways.I strongly recommend bypassing the Kernel mixer.


Second, you need to determine the length of the impulse of your system. A good estimate is the reverb time of the room that you are measuring. It's most convenient to choose a power of 2; for most rooms this will 16384 or 32768 at 44.1kHz or 48 kHz sample rate.


Third, create a periodic excitation of that length. This could either be a log sweep or (better) a pseudo random noise. The spectrum of the noise should be chosen so you get roughly constant signal to noise ratio in the frequency range of interest. That depends on the transfer function and on the background noise spectrum. If you don't know either of those yet, pink is a good start. Let's call one period of this signal x[n].



Fourth, wire up your system so that the left channel from your D/A goes into the loudspeaker AND into the left channel of your A/D. Wire the microphone into the right channel of the A/D.


Fifth, start the excitation (loop it or create a wave file with many repetitions of your noise signal). Carefully monitor all levels: make sure that the A/D sits at about 10 dB below clipping. Make sure the microphone pre-amp sits at about 10 dB below clipping. Make sure the power amp is not clipping and that the loudspeaker is not over driven.


Sixth, make sure that the room is as quiet as it can be. Close doors and windows. Shut off most things with a fan including any HVAC system. Evict all other people from the premises. If there are any ground loops, use isolation transformers and ground lifts as necessary. A good way of checking noise is to hook up a headphone amp to the mic output and listen to it through headsets. Any noise, hum, or other artifact that you can hear will also show up in the measurement.


Seventh, do the actual acquisition. Collect 12 periods with the excitation signal running. Visually inspect the results for something unusual (gaps, parts missing, drop outs, etc.) Throw the first two periods away. Calculate the average over the other 10. Let's call the left channel y[n] (sound card) and the right channel m[n] (microphone).


Eighth, calculate the Fourier Transform of y[n]. This should be fairly flat with no zeros or areas of very low energy. This may not be the case as most sound cards have AC coupled inputs, i.e. there is some high pass filter and the value at DC might be very low. Similarly there may also likely be an anti aliasing filter, so again you may have low energy or just noise at very high frequencies. If can you manually fix that (by adding a small amount of broadband energy), then do. If the spectrum is very flat in the frequency area of interest, you can simply replace it with a properly delayed unit impulse. If none of these will work, things get more complicated.


Ninth: deconvolute. Your transfer function can simply be calculated as $$H(\omega) = \frac{\Im \left \{ m(t) \right \}}{\Im \left \{ y(t) \right \}}$$ where $\Im \{ \}$ denotes the Fourier transform. This is direct spectral division without any zero padding or windowing. Since we are doing circular coherent acquisition we are also doing circular deconvolution.


The equation shows the problem discussed in step 8. We are dividing by a measured spectrum. Any zeros or areas of low energy or high noise in the divisor spectrum will result in garbage in the resulting transfer function. The results at the "good" frequencies will still be okay but you could not use it to, for example, calculate an impulse response. A simplified version would be to just divide by the excitation signal, i.e. $$H(\omega) = \frac{\Im \left \{ m(t) \right \}}{\Im \left \{ x(t) \right \}}$$ and choose the excitation so that there are no zeros in the spectrum. However this will not allow you to deconvolve the D/A and A/D system response and it will also lose any absolute delay information. In many cases this is actually acceptable and many commercial measurement system do just that, so it depends on your application.


Tenth: verify that your measurement is good. Various tests should be performed:



  1. Measure a few times and make sure that the result is the same.


  2. Measure with the loudspeaker muted. This will give you a good estimate of the background noise spectrum. As a rule of thumb, you need at least 10 dB signal to noise ratio at all frequencies of interest.

  3. Linearity test: measure with half the excitation gain and confirm that the resulting transfer function is the same.

  4. A useful inline noise test is the following: Take your 10 periods and average 5 times over 2 periods each, then do a Fourier transform over 2*N samples. If your signal is noise free then all the odd bins should be zero. You can directly estimate the signal to noise ratio at any frequency as X{2*N+1}/X{2*N}


No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...