Peak Detection

When analog sensors change over time, they reach a maximum value for any given amount of time. When you graph the sensor's value over time, this maximum value looks like a peak. Finding the value of a peak for a given period of time is called peak detection. For example, when a person presses a piano key, the last moment before she release is likely when she's pressing hardest. If we're varying the dynamic range of a note played based on how hard the performer hits, we need to know the value of that peak.

Here's a PicBasic Pro example of peak detection.