HISE Logo Forum
    • Categories
    • Register
    • Login

    Spectral Analyser / Ever made one?

    Scheduled Pinned Locked Moved Scripting
    5 Posts 3 Posters 58 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.
    • ChazroxC
      Chazrox
      last edited by

      Does anybody have any good advice on where to start making a spectral analyzer? I just want to be able to load an audio file and point out dominant frequencies in the spectrum and extract frequency values.

      Something like this :

      Screenshot 2025-08-13 at 11.47.18 PM.png

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

        @Chazrox If it's not real time, then the FFT in the API list should do it. Otherwise it needs C++ and a global cable to send the data back to the interface

        Hise made me an F5 dude, browser just suffers...

        Christoph HartC ChazroxC 2 Replies Last reply Reply Quote 1
        • Christoph HartC
          Christoph Hart @ustk
          last edited by

          @ustk yup offline spectrum generation can be done with the inbuilt HISE tools:

          Content.makeFrontInterface(600, 600);
          
          // Create a buffer with a second length
          const var b = Buffer.create(44100.0);
          
          // fill it up with some random signal - two sine sweeps and some noise
          reg uptime = 0.0;
          reg delta = 0.01;
          
          for(s in b)
          {
          	s = Math.sin(uptime);
          	s += 0.5 * Math.sin(uptime * 2.0);
          	s += 0.3 * Math.random();
          	
          	uptime += delta;
          	delta += 0.00003;
          }
          
          // Create the FFT object that is used to create the spectrum
          const var fft = Engine.createFFT();
          
          // Enable the spectrum generation
          fft.setEnableSpectrum2D(true);
          
          // Setup the FFT processing (FFT size & channel count)
          fft.prepare(1024, 1);
          
          // Fetch the spectrum options
          const var options = fft.getSpectrum2DParameters();
          
          // Dump that
          Console.print(trace(options));
          
          // change whatever property you want.
          options.ColourScheme = 2;
          options.Oversampling = 8;
          options.Gamma = 30;
          options.ResamplingQuality = "High";
          
          // Send it back
          fft.setSpectrum2DParameters(options);
          
          // process the buffer. This creates the spectrum
          // that can then be painted
          fft.process(b);
          
          // create a panel
          const var p = Content.addPanel("P1", 0, 0);
          
          p.set("width", 600);
          p.set("height", 600);
          
          p.setPaintRoutine(function(g)
          {
          	// This function paints the FFT spectrum on the panel
          	g.drawFFTSpectrum(fft, this.getLocalBounds(0));
          });
          
          ChazroxC 1 Reply Last reply Reply Quote 5
          • ChazroxC
            Chazrox @ustk
            last edited by

            @ustk for my purpose it wouldn't have to be real time. I'll look into it. Thanks! 🙏

            1 Reply Last reply Reply Quote 0
            • ChazroxC
              Chazrox @Christoph Hart
              last edited by

              @Christoph-Hart woah! I cant wait to try this! Thank You! 🙏

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

              26

              Online

              1.9k

              Users

              12.3k

              Topics

              106.9k

              Posts