Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Vertical Bar/Line FFT/Spectrum Display- Feasible?

For general discussion related FlowStone

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby Youlean » Sat Sep 20, 2014 7:50 pm

You could try this log scaling..
Attachments
Log Scaling.fsm
(449 Bytes) Downloaded 947 times
Youlean
 
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby KG_is_back » Wed Sep 24, 2014 9:14 pm

Perfect Human Interface wrote:Wow KG, this thing is pretty. I changed the multiplier value going into the bar graph module to 0.05 for better visibility. I did notice the scaling seems a bit odd though.
FFT Scale.PNG

Even with the log scaling, the higher frequencies get a lot more space. Tried screwing with the math here but apparently don't know what I'm doing. Maybe it's a log base other than 10 on the PEQ2 meter?

Could alpha blending be added to the draw function easily? For example if I want it to blend between a full transparent and a solid color at max value?

One last thing: This would definitely benefit from a smoothed "release" for those transient sounds.

About time I open a book on Ruby I guess. I've been putting it off as long as possible. :P

Edit: Thinking the scale is log base 2, since that's what pitch is based on. How to apply log math to arrays though? I guess you'd just use Ruby for that too.


Oh, totally missed this post :-D wow....
well... logarithms are just multiplied versions of each other.
to convert linear 0-1 to logz(x) that is also in 0-1 (the Z reffers to base of the logarithm)
you just scale the input to be in 1-z range ( x = 1+x*(z-1) ) and then preform log z on that number.
I will update the module on FSguru right away.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby Perfect Human Interface » Thu Sep 25, 2014 3:13 am

KG_is_back wrote:scale the input to be in 1-z range ( x = 1+x*(z-1) ) and then preform log z on that number.
I will update the module on FSguru right away.


I actually tried this earlier and log base 2 wasn't good. The goal is to scale it to octaves, such that when you move up and down notes or octaves on the input, the display is scaled linearly. Octaves are based on doubles, so an octave above 400 hz is 800 hz, and an octave above that is 1600 hz. With that in mind, I think it is something to do with 2^x, but I couldn't figure it out.
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby KG_is_back » Thu Sep 25, 2014 6:26 pm

Now that I think of it... bins in FFT array are frequencies:
0th value is DC, last value is Nyqist. DC is zero hertz so it should be in the negative infinity on the octave based scale. (that is the first wrong thin in my schematic - DC is simply in the left side)
Nyquist however should have its proper position on the left side of the graph (possibly even outside of view when higher sample rates). Lets define two frequencies that should be the boundaries of our bar graph (20Hz-20kHz).
Now we do not draw the full FFT spectrum only the 20-20k part. We can calculate the index (probably not be integer value) of 20Hz and 20kHz from sample rate and FFT window size.
I have it working now... will post it to FS Guru in short moment...
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby Perfect Human Interface » Thu Sep 25, 2014 9:41 pm

Ah, excited to see it. Too bad the site is down currently.

I was wondering what the frequency range was. Big thanks for looking into this, and for putting the thing together in the first place.
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby KG_is_back » Thu Sep 25, 2014 10:01 pm

I'll just post it here I guess...

Th range limits both linear and logarithmic display.
Attachments
bargraph.fsm
(31.33 KiB) Downloaded 942 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby Perfect Human Interface » Thu Sep 25, 2014 11:59 pm

Looks good! Seems to resemble the IL one most with a 2048 sample size. It's not exactly light on CPU overall but I doubt that can be helped (obviously less samples and less triggers make a big difference).

So it looks like the math was just scaled by taking the log2 then? I'm probably going to be drawing on top of this for filter cutoffs, so hopefully if I just take a normalized 0-1 frequency and do log2(x+1) that should do it.
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby tester » Fri Sep 26, 2014 12:13 am

Nice work KG.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby Perfect Human Interface » Fri Sep 26, 2014 4:41 am

Hmm I have noticed another oddity in this. It seems louder (or higher amplitude) signals seem to push back the other drawn frequencies. So, for example, when the kick hits, the higher frequencies fade out (lower frequencies are generally greater amplitude at the same volume).

It doesn't look like this happens with the original version you uploaded, KG. Did you perhaps add something to limit the range of bar intensity?
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby KG_is_back » Fri Sep 26, 2014 3:44 pm

Perfect Human Interface wrote:Hmm I have noticed another oddity in this. It seems louder (or higher amplitude) signals seem to push back the other drawn frequencies. So, for example, when the kick hits, the higher frequencies fade out (lower frequencies are generally greater amplitude at the same volume).

It doesn't look like this happens with the original version you uploaded, KG. Did you perhaps add something to limit the range of bar intensity?


I'm not aware of anything that may cause that. I didn't change anything that would affect Y input. What I've done though is that I now resize the Y array, so there is actually less strips and therefore they are wider.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 64 guests