HISE Logo Forum
    • Categories
    • Register
    • Login

    FFT analysis programmatically?

    Scheduled Pinned Locked Moved Scripting
    9 Posts 4 Posters 449 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.
    • T
      ThomAce
      last edited by

      Hi,

      Wondering if there is an efficient way to perform FFT analysis on incoming signals from two stereo inputs (4 channels if you wish)... Unfortunately, FFT objects causing HISE crashes when I try to read their buffer from Script FX.

      What I have tried from (https://docs.hise.dev/scripting/scripting-api/fft/index.html) and under the given link to the forum, either did not worked properly or caused immediate crash (certain cases even in case of copy & paste some functions couldn't be found - as HISE said) of HISE.

      I wanted to achieve to do two distinct FFT analysis on input signals (1+2 = mono, 3 + 4 = mono) and "slice" the output into double array by certain amount of frequency ranges. Maybe 12 - 20 - 36 bands... I wanted to make these "magnitudes" to dB scale to spot the highest part and of course, the frequency (or freq range or mid freq of the given range). So these data would be in an array I could inspect.

      Does anyone knows a good way to achieve this? What would be the most efficient way to avoid excessive CPU consumption?

      Many thanks in advance for any constructive advices!

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

        @ThomAce This might be because the buffer isn't locked for secure read access. A display buffer might be able to do what you need.
        Use an analyse.fft node, add an external display buffer, and reference the source that you can then get and read with getReadBuffer (see doc and forum for examples)

        You can adjust to taste the properties of the external buffer like windowing, buffer size, etc...
        Then it is your job to split the buffer into chunks of frequency ranges respecting the logarithmic scale (so don't expect to just split in equal length since an FFT spits out bins in a linear freq fashion).

        You can convert the 0-1 gain to dB if you want to with getDecibelForGainFactor

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

        T 1 Reply Last reply Reply Quote 1
        • T
          ThomAce @ustk
          last edited by

          @ustk Thanks mate. This is where I got stuck recently. HISE crashes always sending me back to starting laten unfortunately.

          From the forum and what you suggested, I came into an almost perfectly working "solution".

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

            @ThomAce Can you put together a minimal snippet?

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

            J T 2 Replies Last reply Reply Quote 0
            • J
              jdurnil @ustk
              last edited by

              @ThomAce please do share, I am looking for a way to process fft in a script node and I can’t find anything

              1 Reply Last reply Reply Quote 0
              • T
                ThomAce @ustk
                last edited by ThomAce

                @ustk A minimal one? Yeah, maybe, but it is not fancy enough and full of stupid things.

                Please double check everything, becuase this version did not fully check if anything goes wrong. And of course, it is not perfect, yet.

                Btw, I'm making this for my upcoming Dynamic EQ for detecting clashing / overlapping frequencies to avoid masking issues.

                If you wish to see a snippet of the VST: a05a9759-fb44-454d-bd01-ffc6f9e57ddd-kép.png

                And there is a HISE Snippet for the code I'm working on to make the FFT processing and visualization working the way I wanted... @jdurnil @ustk

                HiseSnippet 3385.3oc6ZrrbabbbAIWYCX6X6DUoxwoPkxFPhFD.TR9AsrIAIgEiIoPQfPoDIFUC1c.vXtXGjcGPPXUpJma4SHGyg7AjefjJeA4PtjqoxWPt5S1cOy9D.jhDxJ1RkosH2o6d5tmt6o6dlca3IrX99BOiLYaMd.yHyqa1brqr2l8nbWic1BfaVudqsX8EF0FOf56yrMxjYwOCQmI6RFpe9eeZMpC00hECxv3PA2hsKuOWFCsw5eN2woN0l0h2OA02X8crDtaJbDCAUYQyxFCnVGS6x1mhjsfoQlqrsMWJ7ZJoRluQlkpIrG2rmXjql9C4971NLbPEil.izfqKbrQMFgZrYOticivkruAvzFwFfE0FfqZtG2lGAO1P7VJDj3YjzdjYgzp2hoTuJIUuxITuYnRYRnRKoUo21rokGefLFCpOul4NtRlWGJX1SpJZZMV3udUyME.EtxR8oGyp6AChlQgaUt7xD3WEWKWNvz6KImP8H1s6PtMQEATpKStE2efCcbsgc5v7ZB9FXh407mT+9UxCSNwbSR7F.a.lMESJT9rmSsyZNURqjP73iZtyucaf7OnxGVMI+1ai6+nc2d+Oq0c.j25l2b0aAybkUHnAf3OziQj8XDOtaWRaEuIbeB0mzl2E+y.guxMkK8Zoj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ZFh76hJJIrl+rvtSTMTuq.CrUFzqpgPPPDr79jwoy42i0fK72iUywtV6oRUEKDUKcs7nVGCV2jhBUyscof2wNI8GHDpacH42Cl96ZnIdQI.6SxjCvWZfOKEr5PQN8mDls4dezCUFkSnxnGv6xgQ.UBV6jCU2RuV.jFfV9vcYTa+GVeiCacHQ8LYOlCDUQpr5GzdPexmyFS1frG8KDdkFQOwnOZT0ar5SOEe7u+vrFNvpSovg3bTKW6P7SF3tzEKv8o7opszO39T0dA33Io9Z5xFpiM4XHw1tm.Ne.Bpi+TnVQGJzaRHzzIt1S3JBaMKYDJjPoaWrPYrtOyEzFRID+EC4pqe.ygQ8SrU3WtNdyhTuI2jcIrEUtzeYgyze8KL0pKAyIPdw8XkK9R8wJmrpl4LqpsvyTOByasopmUso+7+7e+ee4u1zuYdpMsk2v9JaXXApOmCaAOP33nKNcFEjdmJu54VPBw+iEjdInfzp+XAoerfzKeEjV37JHs3TEj9g8Ai6Ss7DOxReSoXD9qpf.VLWUggrl6giIULNQeeFwQA8g7iOxxJMqlZhUm2It57NwaLuS7ly6Du07Nw2edm3G7zmHV9ZigRQe8lZCi8Zrs9hvxD0LADt9s.3iBSsA
                
                clevername27C 1 Reply Last reply Reply Quote 1
                • clevername27C
                  clevername27 @ThomAce
                  last edited by

                  @ThomAce Remember that masking is fundamentally a psychoacoustic phenomenon. If I understand what you want to do with your plugin, I'd suggest working from that perspective in terms of what you're looking for in time, amplitude and frequency. Hope that's helpful.

                  T 1 Reply Last reply Reply Quote 0
                  • T
                    ThomAce @clevername27
                    last edited by ThomAce

                    @clevername27 Yeah. I'm an indie music producer and this plugin does exactly what I wanted to acheive. (I know you know these, but some others might not, so leaving this hear for making some explanation for the tool: )
                    Masking can be intentional and unintentional. When you are doing it unintentionally, it can cause muddienss, muffled or cloudy song. These are the essential parts that every producer must learn when producing. Sometimes, we are masking intentionally. But, if your kick and bass "kicks in" together, the lower shelf will be roboust, muffled and muddy. Also, you will not be able to maintain clarity in that space and therefore the whole balance of the song was bad, low-shelf oriented and loudness could not be maintained. Here comes the VST I'm making into picture.

                    It's earlier version (Space Maker) was based on Mix Space, but the PRO named version is something that I wanted to achieve more as I have seen some cool features in ProQ. Although, almost all these features I can build in Ableton via racks. Configuration and identification not always that easy and requires extra steps. When I have asked for making a mix and / or mastering for another artist and the time-frame is very tight, these plugins gives a huge helping hand.

                    Just imagine, that you don't have to do long hours of fine-tuning the dynamic EQs as you have visual feedbacks as well that helps you more easily spot the so-called "clashing frequencies" that would cause unintentional masking. So you can easily tune your dynamic EQ to those parts and you are done. Quick, smooth and easy way.

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

                      @ThomAce Cheers and best of luck on the plugin - seems like you're well-equipped.

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

                      47

                      Online

                      1.7k

                      Users

                      11.7k

                      Topics

                      101.8k

                      Posts