Estimating effect of filter on headroom

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












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 = fracsum_n=0^N-1N$



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?










share|improve this question

























    up vote
    3
    down vote

    favorite












    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 = fracsum_n=0^N-1N$



    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?










    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      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 = fracsum_n=0^N-1N$



      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?










      share|improve this question













      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 = fracsum_n=0^N-1N$



      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?







      filters audio processing-gain






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      TheSlowGrowth

      1163




      1163




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          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






          share|improve this answer






















            Your Answer





            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "295"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdsp.stackexchange.com%2fquestions%2f53088%2festimating-effect-of-filter-on-headroom%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            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






            share|improve this answer


























              up vote
              2
              down vote













              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






              share|improve this answer
























                up vote
                2
                down vote










                up vote
                2
                down vote









                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






                share|improve this answer














                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







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 12 mins ago

























                answered 1 hour ago









                Hilmar

                9,255916




                9,255916



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdsp.stackexchange.com%2fquestions%2f53088%2festimating-effect-of-filter-on-headroom%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    List of Gilmore Girls characters

                    Confectionery