Peak detection of data

Laura Papke's icon

Hi there, I would like to detect peaks in some data that I am receiving in MaxMSP (mainly going up and down from around 0 to 600) . I specifically would like bang messages with each detected peak. I already tried to implement the peak object which catches the peak once but then it got stuck and I couldn't go further. Does someone have a tip? Thank you!

👽'tW∆s ∆lienz👽's icon

one way to detect multiple peaks is to track the negative or positive change in order to detect whether values are 'falling' or 'rising' and then reset the 'peak' detection at the start of every new rise:

Max Patch
Copy patch and select New From Clipboard in Max.

other techniques might use this as a basic technique, and then add some kind of 'threshold' for the 'degree of change'(a range of values that is counted as being significant) before detection in either direction is desired.

hope it can help 🌻 ...or that others here might have a better solution, too 🙏

Wil's icon

good to try different methods.

Max Patch
Copy patch and select New From Clipboard in Max.

👽'tW∆s ∆lienz👽's icon

hadn't encountered the '+'/'-' modes of event-based object [change] before, that second one by WIL is beautifully concise! 🫶

WIL FTW! :)


Laura Papke's icon

Thank you all so much, will immidiately dive into your tips <3