5
$\begingroup$

I am working with beamforming algorithms for speaker arrays. One of the problems we face is that we need to estimate the maximum amplitude of our test signals after we applied FIR/IIR filters to them. I am looking for ways to express the reduction in headroom that a given set of filters would give us. Ultimately I want to know by how much I have to attenuate my input signal to definitely avoid clipping in the DAC, with respect to the filter.

For sine sweeps, this is easy: The maximum of the filters magnitude response is also the maximum amplitude gain we can expect. However, for broadband signals, this is not as simple.

I considered adding up $N$ sine waves of frequencies $\omega_n$ covering the range of 0Hz - Nyquist. If my filter input signal consisted of sines with amplitude 1, the maximum amplitude of this "stacked sine" signal would be $y_{max} = N$.

Looking at an output signal of the filter, the same method can be used to estimate the maximum amplitude: This time, the amplitudes would not be 1 but $|H(\omega_n)|$ and the maximum output amplitude would be $\sum_{n=0}^{N-1}|H(\omega_n)|$.

I could now compare the maximum input amplitude with the maximum output amplitude:

$AmplitudeGain = \frac{\sum_{n=0}^{N-1}|H(\omega_n)|}{N}$

My hope was that I may see by what amount I'd have to attenuate my broadband input signal to avoid clipping. The truth is that I'm really calculating the average of my magnitude response and that there are signals for which the calculated gain would produce clipping. Consider the following magnitude response, which is the result of a superdirective beamforming optimization:

example magnitude response

As you can see, the maximum gain is about 13dB, but my formula would return the average which is in this case -12.8dB. This tells me that there is an error in my thinking. Adding up the respective maximum values of all sine-components of a broadband signal should give me the highest amplitude this signal could ever reach, right? Apparently my approach in itself is wrong.

How could I better estimate the maximum amplitude gain of my filter for broadband signals?

$\endgroup$
4
$\begingroup$
  1. For an input with limited amplitude, the maximum amplitude gain of a filter can be calculated as the absolute sum of the impulse response
  2. Scaling with the inverse of the absolute sum, will guarantee that your max output amplitude will never exceed the max input amplitude
  3. In practice, this does NOT work well: It's a very conservative scaling that often results in bad signal to noise ratio and the input signal that would actually trigger the max amplitude gain is extremely unlikely to occur. Scaling this way leaves a lot of headroom on the table.
  4. A better approach is to look at your worst case sine wave gain. Sine waves (or similar signal) do happen in music and audio a lot, so that's a much more likely scenario. Especially in your case, where the max is around 200 Hz.
  5. That still may not result in acceptable signal to noise ratio: in this case you can "eye ball" the gain at the most important frequencies and use a limiter or soft-clipper to manage the occasional overshoot.

In your particular case, I'd probably go with -10dB scaling with a limiter (provided, it's implemented in floating point). At the end of the day this is a trade off between managing clipping/overshoots, efficiency, signal to noise ratio and max output capability. It needs to be optimized within the specific requirements of your application

$\endgroup$
  • $\begingroup$ Thank you for your detailed answer. I now understand that the sum of my impulse response is the worst case output amplitude (for unity input). I know that this is not optimal in terms of SNR, but I'm looking for a way to quantify the performance of various filter realizations - so a simple metric (even if it is overly conservative) is totally fine. While your solution 1) is great for digital filters, it is not suitable for analog filters. My approach was coming from a more general perspective. I would expect we get to the same conclusion, but my formula has that $1/N$ . Do you see why? $\endgroup$ – TheSlowGrowth Nov 6 '18 at 12:10
  • $\begingroup$ No I don't. You basically use the average gain per frequency. This would work ok if your input signal would be stationary white noise. For most types of audio signals, I'm guessing you are going to see a lot of clipping. $\endgroup$ – Hilmar Nov 7 '18 at 14:12
2
$\begingroup$

As mentioned in Hilmar's answer, without any extra information, the only scaling that guarantees no increase in signal amplitude is $l_1$-scaling, i.e., scaling by $\sum_n|h[n]|$, where $h[n]$ are the filter coefficients:

$$\big|y[n]\big|=\left|\sum_kh[k]x[n-k]\right|\le\max_n\big|x[n]\big|\sum_k\big|h[k]\big|\tag{1}$$

In practice, this type of scaling is often too conservative, especially for narrow-band signals.

Another common type of scaling is scaling by the Chebyshev norm of the frequency response $\max_f|H(f)|$, where $H(f)$ is the filter's frequency response. This makes sure that the filter's steady-state response to a sinusoidal input will not overflow, but transients may occasionally lead to larger outputs. This type of scaling is well-suited for narrow-band signals.

Yet another common scaling is $l_2$-scaling, i.e., scaling by $\sqrt{\sum_n|h[n]|^2}$. It is even less conservative than scaling based on $\max_f|H(f)|$.

$\endgroup$
  • $\begingroup$ that "Chebyshev norm" can also be called the $l_\infty$ norm (in your case, applied to the frequency response). $\endgroup$ – robert bristow-johnson Nov 5 '18 at 21:17

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.