Package at.ofai.music.util
Class Peaks
- java.lang.Object
-
- at.ofai.music.util.Peaks
-
public class Peaks extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field and Description static boolean
debug
static int
post
static int
pre
-
Constructor Summary
Constructors Constructor and Description Peaks()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static double
expDecayWithHold(double av, double decayRate, double[] data, int start, int stop)
static int
findPeaks(double[] data, int[] peaks, int width)
General peak picking method for finding n local maxima in an arraystatic java.util.LinkedList<java.lang.Integer>
findPeaks(double[] data, int width, double threshold)
General peak picking method for finding local maxima in an arraystatic java.util.LinkedList<java.lang.Integer>
findPeaks(double[] data, int width, double threshold, double decayRate, boolean isRelative)
General peak picking method for finding local maxima in an arraystatic void
getSlope(double[] data, double hop, int n, double[] slope)
Uses an n-point linear regression to estimate the slope of data.static int
imax(double[] arr)
static int
imin(double[] arr)
static double
max(double[] arr)
static double
min(double[] arr)
static void
normalise(double[] data)
static boolean
overThreshold(double[] data, int index, int width, double threshold, boolean isRelative, double av)
-
-
-
Field Detail
-
debug
public static boolean debug
-
post
public static int post
-
pre
public static int pre
-
-
Method Detail
-
findPeaks
public static int findPeaks(double[] data, int[] peaks, int width)
General peak picking method for finding n local maxima in an array- Parameters:
data
- input datapeaks
- list of peak indexeswidth
- minimum distance between peaks
-
findPeaks
public static java.util.LinkedList<java.lang.Integer> findPeaks(double[] data, int width, double threshold)
General peak picking method for finding local maxima in an array- Parameters:
data
- input datawidth
- minimum distance between peaksthreshold
- minimum value of peaks- Returns:
- list of peak indexes
-
findPeaks
public static java.util.LinkedList<java.lang.Integer> findPeaks(double[] data, int width, double threshold, double decayRate, boolean isRelative)
General peak picking method for finding local maxima in an array- Parameters:
data
- input datawidth
- minimum distance between peaksthreshold
- minimum value of peaksdecayRate
- how quickly previous peaks are forgottenisRelative
- minimum value of peaks is relative to local average- Returns:
- list of peak indexes
-
expDecayWithHold
public static double expDecayWithHold(double av, double decayRate, double[] data, int start, int stop)
-
overThreshold
public static boolean overThreshold(double[] data, int index, int width, double threshold, boolean isRelative, double av)
-
normalise
public static void normalise(double[] data)
-
getSlope
public static void getSlope(double[] data, double hop, int n, double[] slope)
Uses an n-point linear regression to estimate the slope of data.- Parameters:
data
- input datahop
- spacing of data pointsn
- length of linear regressionslope
- output data
-
min
public static double min(double[] arr)
-
max
public static double max(double[] arr)
-
imin
public static int imin(double[] arr)
-
imax
public static int imax(double[] arr)
-
-