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

Vertical Bar/Line FFT/Spectrum Display- Feasible?

Postby Perfect Human Interface » Thu Sep 18, 2014 10:56 am

Not sure what will come of this but I'm just going to open the discussion.
Something approximately along the lines of this:
PEQ2 Spectrum.PNG
PEQ2 Spectrum.PNG (139.72 KiB) Viewed 16778 times

Would be wonderful to have in FS. I find it to be FAR more readable than the typical line-graph style FFT for most practical applications.

I've searched and could only dig up one example of this in the forums (including SM forums), here:
viewtopic.php?f=2&t=2446&hilit=fft

While that schematic appears functional, it devours CPU and drags down the draw rate, and only more so if you increase the window size.

Do you think something like this that's efficient enough and fairly accurate is feasible in FS? It's kind of frustrating that the line-graph style FFT is so easy to piece together in FS yet just drawing vertical lines from an FFT array is so much more complicated. :?
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 18, 2014 2:43 pm

I've made one and now I added it to FS Guru

http://flowstone.guru/downloads/gradient-bar-graph/

note that there is a bug in flowstone, that when you resize the module gui, sometimes rectangles that should be directly adject to each other (based on their area position) have one pixel gap between them. I believe it has something to do with converting form grid scales to pixels when drawing gui elements.
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 18, 2014 10:51 pm

Well dang... thanks KG!

Re: the bug, does it always seem to be 1 pixel even when you zoom in with Flowstone's zoom slider? I've noticed that kind of inaccuracy with drawn objects a lot in FS and it kind of drives me bonkers.

I will definitely check that out a little later!
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 19, 2014 12:06 am

Perfect Human Interface wrote:Well dang... thanks KG!

Re: the bug, does it always seem to be 1 pixel even when you zoom in with Flowstone's zoom slider? I've noticed that kind of inaccuracy with drawn objects a lot in FS and it kind of drives me bonkers.

I will definitely check that out a little later!


You're welcome! I was looking to find such module some time ago too. I just recently learned ruby (and still learning) to a degree I was able to reproduce it.

And to the Bug. Yes, I have tested the thing with zooming too. It is one pixel no matter the zoom. Actually when I turn off smoothing it is gone. From what I can tell this is happening:
0.the background is drawn
1.Flowstone receives command to draw first rectangle
2.Converts his grid position to screen pixels (as float)
3.with "smoothing on" it uses the fractional part of the coordinates to interpolate the values on the borders (so the rectangle may have semitransparent one pixel border)
5.applies the rectangle to the background (background is basically a bitmap)
4.Flowstone receives command to draw second rectangle
5.Converts his grid position to screen pixels (as float)
6.with "smoothing on" it interpolates the fractional part and allows semi transparency
7.applies the rectangle to the background (remember the background already contains the first rectangle)
The semitransparent border of the first rectangle gets overlaid by semitransparent border of the second rectangle. Because both rectangles are semitransparent, the background still shines through.

So in the end is not actually a bug, but a normal behavior.


EDIT: I have noticed that the gap sometimes happens even if the smooting is off. It seems the rectangle areas are rounded differently
Attachments
smoothing causes the bug.fsm
(442 Bytes) Downloaded 968 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 » Fri Sep 19, 2014 12:21 am

KG_is_back wrote:So in the end is not actually a bug, but a normal behavior.


I think the next step would be to check whether rectangles drawn with smoothing still do that even when given exact pixel-unit parameters (in theory they shouldn't if it's proper interpolation). And grid-square dimensions are in exact pixels, aren't they? From what I recall I've seen this with just drawing rectangles into full grid-snapped views and then layering them- they bleed through on the edges.
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

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

Postby tulamide » Fri Sep 19, 2014 1:16 am

Perfect Human Interface wrote:And grid-square dimensions are in exact pixels, aren't they?

At zoom 100% they are. One grid square then corresponds to 8x8 pixels.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

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

Postby Perfect Human Interface » Fri Sep 19, 2014 2:56 am

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
FFT Scale.PNG (189 KiB) Viewed 16725 times

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.
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

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

Postby Perfect Human Interface » Fri Sep 19, 2014 3:33 am

Hey look at me! I added alpha all by myself! :lol:

It's only for the background (min) color though (the "max" color is doing something else I'm not sure of with the alpha). Still useful. I mean that was the more important part. I blopped a background image in there just for demonstration.

Edit: Figured out how to set/scale the bar (max) alpha, but it's pointless here since it's just drawn on top of the background color with alpha in the first place. You can just scale the input values and it would do the same thing.
Attachments
Gradient-Bar-Graph_Alpha1.fsm
(309.78 KiB) Downloaded 1022 times
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

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

Postby Perfect Human Interface » Fri Sep 19, 2014 5:14 am

And just for fun...

VertScale.PNG
VertScale.PNG (7.09 KiB) Viewed 16721 times
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 19, 2014 7:57 am

Perfect Human Interface wrote:y look at me! I added alpha all by myself! It's only for the background (min) color though (the "max" color is doing something else I'm not sure of with the alpha). Still useful. I mean that was the more important part. I blopped a background image in there just for demonstration.Edit: Figured out how to set/scale the bar (max) alpha, but it's pointless here since it's just drawn on top of the background color with alpha in the first place. You can just scale the input values and it would do the same thing.


That gave me an idea. Look at new version at FSG http://flowstone.guru/downloads/gradient-bar-graph/#description

The old version first draws the background color and than draw the bar color gradients, where the y value sets alpha.
New version with transparency support does not draw background. Instead it uses y values to interpolate between back and foreground color.
I've kept the old version too, because it's lighter on CPU.

Also I've found what was causing the bug with those one pixel lines in the bar graph. It was the gradient - sometimes the gradient wrapped one pixel early. I've changed the wrapping mode, so now when it happens it is not even visible (it possibly can be, if you'd draw so much bars they'd be one pixel wide... but that's ridiculous).
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Next

Return to General

Who is online

Users browsing this forum: No registered users and 86 guests