Forum audi users

Forum audi users



SearchSearch   Users   Registration   Entrance
Today: 27.08.2026 - 10:51:03
Pages:  1  

How to make a spectrum analyzer in Jsfx?

MessageAuthor

Hi Guys, I want spectrum analyzer to show in my ImGUI script, but I need a JSFX to process the samples and then feed that into ImGUI. I've looked into "Frequency Spectrum Analyzer Meter (Cockos)", I think the bit that extracts audio information into a frequency spectrum would be the @block and @sample sections? Would someone please be so kind to briefly explain what these few lines are doing, and what variables I need to put into gmem to transfer that data to ImGUI? ---the code is here--- @block slider2 != lfloor ? ( lfloor = slider2; minvol=2*exp(log(10)/20*slider2); ); @sample abs(recpos[]=spl0) > minvol ? update=1; recpos = ((recpos+1) >= histsize ? 0 : (recpos+1)); abs(recpos2[]=spl1) > minvol ? update=1; recpos2 = ((recpos2+1) >= histsize2 ? shift : (recpos2+1)); Thanks very much!!




GEN3RIC

Pessimist


Statistics:
Messages: 4,954
Registration: 01.10.2003
23.01.22 - 05:45:27
Message # 1
RE: How to make a spectrum analyzer in Jsfx?

Well, recpos[0..histsize-1] contains the time-domain samples, but these are transformed to the frequency domain in @gfx; look for fft_real(). This frequency-domain data is probably what you need. BTW, the original gfxanalyzer is mono (spl0+spl1), but the code you posted seems to support 2 separate channels.




RacermeX

Pessimist


Statistics:
Messages: 89
Registration: 01.17.2002
23.01.22 - 05:52:16
Message # 2
RE: How to make a spectrum analyzer in Jsfx?

Hi Tale, Thanks for the reply! I found the fft_real line: fft_real(fftworkspace,fftsize); fft_permute(fftworkspace,fftsize/2); and here are the lines that defines fftworkspcae: histsize=max_fft_size + (max_fft_size*0.5 - 1); window=histsize; fftworkspace=window+(max_fft_size*0.5 + 1); Still quite clueless on what's going on in this script despite taking another hour or so today studying it and reading the jsfx introduction page on Reaper's official site... Just wondering how you learned it? Any recommended source? Thanks!




cchase009

Pessimist


Statistics:
Messages: 200
Registration: 06.12.2003
23.01.22 - 05:58:37
Message # 3
RE: How to make a spectrum analyzer in Jsfx?

OK I feel like I should make my question more specific, is the fft line going to return something like an array of numbers for each frequency? and the fft size is basically how many bands it has? So if size is 16, it will return 16 numbers in an array..? But where do I retrieve that number..? Sorry I have so many questions, really really appreciate it if someone can help me out!




butterm3

Pessimist


Statistics:
Messages: 17
Registration: 01.29.2002
23.01.22 - 06:08:22
Message # 4
RE: How to make a spectrum analyzer in Jsfx?

I might be wrong but I think you need to do a stft ( fft will return the energy across all the audio ). I know little about DSP but I think this video might lead you in the right way




Seedster

Pessimist


Statistics:
Messages: 96
Registration: 02.26.2001
23.01.22 - 06:14:27
Message # 5
RE: How to make a spectrum analyzer in Jsfx?

Thanks for the inputs! I've made it work with copying lines from the original jsfx, still have many things that I don't understand on the math side of things, I'll learn about it slowly I guess. Just one more question, because the part that sends the fft information is written in @gfx, it'll only send information when the fx window is open. I moved it to the @block section, and it now can send information while it's closed, but it becomes more cpu intensive, as it's processing information in a much higher frequency. I'm wondering if there's a way to limit the update frequency in @block section...? Thanks!!




Sh4rkAttk

Pessimist


Statistics:
Messages: 265
Registration: 04.21.2003
23.01.22 - 06:20:06
Message # 6
RE: How to make a spectrum analyzer in Jsfx?

You can just increment a counter in @block, reset to 0 when it gets to whatever number you want, and then only run the actual code when that counter equals 0.




mpowernyc

Pessimist


Statistics:
Messages: 153
Registration: 07.03.2001
23.01.22 - 06:24:52
Message # 7
RE: How to make a spectrum analyzer in Jsfx?
New Song - Light Storm : Previous topicNext topic: Need help deinterlace 1080i 29,970..
Pages:  1  

The administrator has prohibited guests from replying to messages! To register, follow the link: register


Participants

Made possible by: XenForo Ltd 8.3.3