getPeaksValleys

fun getPeaksValleys(targetIntervalsCents: FloatArray, config: PeakDetectionConfig = PeakDetectionConfig.DEFAULT): PeakData

Detect peaks and valleys using the specified method and target intervals.

Internally pads the histogram with empty bins on both sides before delegating to PeakDetection. Both detection paths require headroom past the data extremes — the interval method's PeakRefinement step rejects peaks where posIdx == rightValleyIdx (boundary peak with no right valley), and Billauer's lookahead loop in the slope method skips peaks within lookahead bins of the array end. Without padding, the highest- and lowest-sung notes are silently dropped whenever the user's range coincides with the histogram boundary — a common case for short Smart Tanpura sessions where the contour doesn't extend past the topmost / bottommost note.

Padding is invisible to callers: PeakData returns positions in cents (not bin indices), and the empty padded bins contribute no peaks of their own.