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

multiple peak finding in array

For general discussion related FlowStone

multiple peak finding in array

Postby tester » Mon Jun 03, 2013 12:36 am

Let say that I have a large array of floats (FFT?). How to find multiple peaks within it?

I guess, the procedure would have to compare each value with it's preceding and succeeding neighbours, to determine, whether it's a peak or not. (or it should be done in different way than dealing with 3 points?).

I guess, there could be some rule, to ignore results if both differences (N to N-1 and N to N+1) are small, within some range. (both sides would have to be in-signifficant). (FFT would be smoothed via Hanning window before it goes to analysis).

I gues, there can be some threshold set, to ignore all values below certain level. (noise trafic, vertical range).

I guess there could be some index limiter, to set the desired FFT range of freqs (horizontal range) for analysis. (i.e. even if array is large, let say, you wish to find peaks within A=230 to B=3000 range).

I guess, it can be easilty done with loops, but it will probably work horribly slow for larger array (128k array?).

But that's all i can guess, maybe I'm missing something.

Could someone make such multiple peak finding in ruby?

MyCo? Trog?
MyCo my Hero? ;-)
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: multiple peak finding in array

Postby RJHollins » Mon Jun 03, 2013 12:58 am

Hi tester,

You're on another interesting mission I see :lol:

Your mention of 'multiple peaks' suggests a more involved solution no doubt.

Without knowing all possible conditions ... you'd have a situation where each sample 'level' would need to be ranked and marked. [so it would seem].

I think there is a prim function that identifies a MAX value in the Array. If not mistaken, it would only give a single result. If this is so ... you could, using a temp array, remove the MAX'd value from the list and then rescan for the remaining MAX value, remove and repeat. Does not seem a very efficient method though.

Is it possible to do an Array 'Sort' by level ? This could possibly organize the array from highest to low. The INDEX number would identify its true position in the original array. Then a type of 'threshold' could be declared to list out the top values now at the start of the list.

Hey ... I know, just a crazy idea. And there's more where that came from :shock:
:lol:

I'll spare the reader until you solve it, or maybe explain more what you're needing to do.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: multiple peak finding in array

Postby tester » Mon Jun 03, 2013 1:30 am

"Max" prim will find only one peak.

Depending on project, but let say I example this one. Even if I narrow the index range - I still will have around 6-10 peaks to find per range.

As for sorting - it can't work that way, because data are ascending/descending with peak points between. If I sort data, then several lower peaks will disappear within other asc/desc floats, related to higher peaks.

Keep in mind, that these are not digital data. Sonic and other types of spectra.

...which gives me to think about this "smoothing" during analysis. May not work as I thought? :-) I'm trying to imagine a little bit distorted slope vs gentle mountain with semi-flat top...

*

It's not another mission, it's one of the first ones. :-)
I needed to take a break from "tuned" randomizer I'm finishing for my app (drives me crazy a little bit).
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: multiple peak finding in array

Postby RJHollins » Mon Jun 03, 2013 1:39 am

If the MAX would identify the 'largest' value, then that would be a starting point to determine a threshold maybe.
A 'range' below that threshold could then set the condition to compare each sample against.

But from what I'm gasping ... the sample data may not fit the criterion I'm thinking on ...

Just trying to stir the thoughts :)
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: multiple peak finding in array

Postby tester » Mon Jun 03, 2013 1:45 am

Nope. In mentioned above example - peaks tend to go in singles or pairs or triples or quads with very narrow differences between.

Remember when I asked fro high resolution FFT? Trog made one with 128kpts resolution with ruby, and Martin did his excellent work on SM forum for small ranges (unfortunately I was not able to extend it to ~50Hz range without crashing FS). The destination is to get peak freqs for further analysis/processing (microtuning, resonances and stuff like that).

Besides as I said - dealing with it via loops - will be probably much slower than pushing it through ruby.
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: multiple peak finding in array

Postby RJHollins » Mon Jun 03, 2013 1:56 am

I understand better about the peak nature ... very common for transient peaks to cluster.

But you mention 'other' peaks that could exist in lower signal levels ??? That's what confused me.

So, you are not looking to just identify the highest peak values in a sample. It sounds like you want to track the 'internal 'dynamics as well. I'm still guessing about this.

Is this something like a 'envelope tracker' with a dynamic sensitive 'auto' threshold ?
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: multiple peak finding in array

Postby tester » Mon Jun 03, 2013 2:00 am

Nope, it's for my small research.
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: multiple peak finding in array

Postby MyCo » Mon Jun 03, 2013 9:11 am

I accept PayPal :mrgreen:
Attachments
Peak Finder (MyCo).fsm
(2.64 KiB) Downloaded 938 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: multiple peak finding in array

Postby tester » Mon Jun 03, 2013 1:21 pm

MyCo wrote:I accept PayPal :mrgreen:


I guess we have something in common :mrgreen:

Thanks.

One small thing. "Threshold" node seems to be set for something else or not work. See on attached array example. Threshold should "cut" some values from analysis.

Now - because these are relative decibels in regards to "zero on top", threshold should elliminate from analysis all values below certain level. For examle, the total range is more than -170dB, but I would like to cut out from analysis all values below -60dB. Everything above -60dB would matter here.

How?
Attachments
sample-4k-256kpts.zip
(108.88 KiB) Downloaded 927 times
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: multiple peak finding in array

Postby MyCo » Mon Jun 03, 2013 2:07 pm

...
Attachments
Peak Finder2 (MyCo).fsm
(3.05 KiB) Downloaded 952 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Next

Return to General

Who is online

Users browsing this forum: Google [Bot] and 83 guests

cron