Page 1 of 1
Logarithmic Spectrum Analyzer
Posted: Mon Apr 14, 2014 5:33 am
by SBAudio
Hello everybody! First time poster, long time creeper here (and synthmaker too)

, and I figured It was finally time to ask for help.
So basically, I'm making a spectrum analyzer and I can't seem to figure out how to transform the frequency axis from linear to logarithmic. I'm not using the graph lines module, but using a draw loop to assign values from the FFT to color intensity of single lines. If anyone can give me some pointers, I'd be eternally grateful!
-Luke
Re: Logarithmic Spectrum Analyzer
Posted: Tue Apr 15, 2014 1:11 pm
by KG_is_back
Here you go. I reworked your x-indexing system a little. The draw loop outputs 0-1 (1/N) being the step), which is in case of linear scale multiplied by width and in case of logarithmic scaled by y=log10(1+x*9) which also outputs 0-1 but logarithmically scaled. That is also multiplied by width and viola...log scaled window. Also I had to redo the line widths, bacause in case of lin scaled the bar should be 1/N wide, but in case of logarithmic the width varies (lower bars are thicker than higher ones).
Re: Logarithmic Spectrum Analyzer
Posted: Tue Apr 15, 2014 1:33 pm
by KG_is_back
However the problem with your method is, that lines are drawn from center to sides...this is OK when drawing linear graphs but in logarithmic the width of the line to left should be different than width to right. So it is better to use rectangles instead of lines. Here - this one uses rectangles instead of lines - the width of all rectagles is width of the window, but ther x-offset changes. Rectangles of high frequencies overlap the right-side of the rectangle, so no rectangle-width correction is needed.
Re: Logarithmic Spectrum Analyzer
Posted: Tue Apr 15, 2014 2:23 pm
by tester
This will not start in synthmaker, it uses FS components.
Loads only in FS, so it's better to rename ext to fsm.
Re: Logarithmic Spectrum Analyzer
Posted: Tue Apr 15, 2014 3:26 pm
by SBAudio
Thanks for explaining, I understand much better now! I think using lines was messing with my head or something, but yours works great!