Spectral Analyser / Ever made one?
-
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 :
-
@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
-
@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)); });
-
@ustk for my purpose it wouldn't have to be real time. I'll look into it. Thanks!
-
@Christoph-Hart woah! I cant wait to try this! Thank You!