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 array
      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
      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
      static 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) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • debug

        public static boolean debug
      • post

        public static int post
      • pre

        public static int pre
    • Constructor Detail

      • Peaks

        public Peaks()
    • 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 data
        peaks - list of peak indexes
        width - 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 data
        width - minimum distance between peaks
        threshold - 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 data
        width - minimum distance between peaks
        threshold - minimum value of peaks
        decayRate - how quickly previous peaks are forgotten
        isRelative - 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 data
        hop - spacing of data points
        n - length of linear regression
        slope - 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)