Estimating effect of filter on headroom 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: 



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?
For an input with limited amplitude, the maximum amplitude gain of a filter can be calculated as the absolute sum of the impulse response
Scaling with the inverse of the absolute sum, will guarantee that your max output amplitude will never exceed the max input amplitude
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.
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. 
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