HISE Logo Forum
    • Categories
    • Register
    • Login

    Can You Determine if HISE's Output Ever Clipped?

    Scheduled Pinned Locked Moved Solved General Questions
    9 Posts 3 Posters 459 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • clevername27C
      clevername27
      last edited by

      Is there an efficient way to know if the output has ever clipped? Thank you.

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @clevername27
        last edited by ustk

        @clevername27 With a scriptFX:

        // Main interface script
        global = _peakValue = 0.0;
        
        // in a scriptFX processBlock
        for (c in channels)
        {
            for (s in c)
            {
                if (Math.abs(s) > _peakValue)
                    _peakValue = s;
            }
        }
        

        Then read the global with a timer, reset it with a button if you need...
        Note that this is not true peak.

        Alternatively, this might be more elegant and lighter on CPU:

        // oninit
        reg mag;
        
        // processBlock
        for (c in channels)
        {
            mag = c.getMagnitude(0, c.length);
        	
            if (mag > _peakValue)
                _peakValue = mag;
        }
        

        In fact, it can even be reduced to:

        for (c in channels)
        {
             _peakValue = Math.max(_peakValue, c.getMagnitude(0, c.length));
        }
        

        Can't help pressing F5 in the forum...

        d.healeyD 1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey @ustk
          last edited by

          @ustk Won't this work with a regular script too like we do for VU meters?

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          ustkU 2 Replies Last reply Reply Quote 0
          • ustkU
            ustk @d.healey
            last edited by ustk

            @d-healey I reckon we treated the topic a while ago. For what I remember, I was saying that when you read the VU current level meter, you get the value at this exact moment. There's no memory for what happened in between. For this you need to test all samples (or the buffer's magnitude) and record it for when you are ready to read it.

            Can't help pressing F5 in the forum...

            1 Reply Last reply Reply Quote 1
            • ustkU
              ustk @d.healey
              last edited by ustk

              @d-healey I have made the tests, current level reading, peak, and true peak, and the results were indisputable (and compared against commercial measuring tools too)

              Can't help pressing F5 in the forum...

              1 Reply Last reply Reply Quote 2
              • ustkU
                ustk
                last edited by

                @d-healey I have corrected the second solution above that had a mistake...

                Can't help pressing F5 in the forum...

                clevername27C 1 Reply Last reply Reply Quote 0
                • clevername27C
                  clevername27 @ustk
                  last edited by clevername27

                  @ustk Thank you @d-healey and @ustk for your suggestions. I had thought Engine.getMasterPeakLevel on a timer would be most efficient—but my concern with all these approaches is that we're only measuring the peak at a given moment—and missing all the possible peaks in between taking measurements. Do your or the Engine function search the current buffer for peaks, or is it simply moment by moment? Than you.

                  ustkU 1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk @clevername27
                    last edited by

                    @clevername27 That is what I am saying, my solution gives you the real peak (not to be mistaken with true peak) and should be the way to go.
                    On the contrary and as you said, a mesure of the meter (current level or master peak level) will give you the reading only at one moment which is a no go for telling if the signal ever passed above 0dB. It's good for a level visualisation only.

                    Can't help pressing F5 in the forum...

                    clevername27C 1 Reply Last reply Reply Quote 1
                    • clevername27C clevername27 marked this topic as a regular topic on
                    • clevername27C clevername27 marked this topic as a question on
                    • clevername27C clevername27 has marked this topic as solved on
                    • clevername27C
                      clevername27 @ustk
                      last edited by

                      @ustk, @d-healey Thank you!

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post

                      62

                      Online

                      1.7k

                      Users

                      11.7k

                      Topics

                      101.8k

                      Posts