converting bitmap graph to wavetable

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

converting bitmap graph to wavetable

Post by tester »

Sometimes there are situations, when you have no way to get text data, but graphs are available. Graphs, that can be cleaned (to single curve on white rectangle) and converted to B/W.

So the question. DiD anyone played with that topic? Converting bitmap graphs into shape data for avetables? Solved issues of "thick lines", to get smooth "vector"?

p.s.: I'm duplicating this topic from SM forum, because I'm not sure who is where.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
strangeChild
Posts: 47
Joined: Sat Apr 27, 2013 8:04 pm

Re: converting bitmap graph to wavetable

Post by strangeChild »

Unless you're talking about hundreds of waves it's likely easier to trace them by eye over the image... a FS/SM type image file display with a draw-over feature that output a float array would be a (relative) no-brainer...

Recognizing scale and lines (and ignoring noise and other irrelevancies) from raw image data would be a major programming project (IMHO).
strangeChild
Posts: 47
Joined: Sat Apr 27, 2013 8:04 pm

Re: converting bitmap graph to wavetable

Post by strangeChild »

Thought about it some more... it would be feasible and not that huge a project provided the function line was defined for all pixels across the horizontal range and you're ok with normalized data as output and there was no junk in the image. You can scan downward (increasing value) in each column looking for the first pixel above some threshold and record it's vertical position. Populate an array and then invert (for drawing position convention), scale (resample), and normalize.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: converting bitmap graph to wavetable

Post by tester »

FSM example?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
strangeChild
Posts: 47
Joined: Sat Apr 27, 2013 8:04 pm

Re: converting bitmap graph to wavetable

Post by strangeChild »

here's a draft... the normalization stuff isn't working the way I expect but you should get the idea... I used a min/max detect instead of a threshold for ease of programming (not done in Ruby!).

It's dreadfully slow because it's a double loop going through every pixel.
waveExtract.fsm
(6.72 KiB) Downloaded 1011 times
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: converting bitmap graph to wavetable

Post by tester »

Found this:
http://synthmaker.co.uk/forum/viewtopic ... 997#p91235

Generally I never played with graphics (yet), so the whole thing is new for me (...and it must wait until I finish other things), but as far I remember Trog wrote somewhere in the past also about averaging pixels for such detection, so the topic is "somewhere" (here or on SM forum). Plus i guess there will be something about interpolation (here or via resample module?).

In that one - I'm not against ruby. I just need (in the future) a small tool to convert (prepared) small bitmaps into 4k (or less) shapes for wavetabling.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: converting bitmap graph to wavetable

Post by RJHollins »

Was wondering if any development came about on this idea ??

I'm finding a situation that I'd like to convert an image of a graph to a vector display to save space.
Here is an example of the typical image:
VSTAnalyzer [3Dent].jpg
VSTAnalyzer [3Dent].jpg (33.52 KiB) Viewed 14870 times

[was a BMP ... had to convert to JPG to post.]

In vector form, I had thought I could alter the scaling [size] and still maintain clarity for display.
Post Reply