be.hogent.tarsos.util.histogram
Class HistogramFactory

java.lang.Object
  extended by be.hogent.tarsos.util.histogram.HistogramFactory

public class HistogramFactory
extends java.lang.Object

This class creates different kinds of histograms from either a list of annotations or a list of peak positions.

Author:
Joren Six

Method Summary
static PitchClassHistogram createMaxPitchClassHistogram(java.util.List<Annotation> annotations, double duration, TimeUnit unit)
          Create a pitch class histogram by taking the maximum number of annotations for a defined time window.
static KernelDensityEstimate createPichClassKDE(java.util.List<Annotation> annotations, double width)
          Creates a pitch class KernelDensityEstimate for a list of annotations.
static KernelDensityEstimate createPichClassKDE(java.util.List<Annotation> annotations, double width, double windowDuration)
          Creates a pitch class KernelDensityEstimate for a list of pitches defined by the annotations.
static KernelDensityEstimate createPichClassKDE(ScalaFile scalaFile, double width)
          Creates a pitch class KernelDensityEstimate for a list of pitches defined by a Scala file.
static PitchClassHistogram createPitchClassHistogram(KernelDensityEstimate kde)
          Creates a pitch class histogram directly from a list of annotations (without kernels).
static PitchClassHistogram createPitchClassHistogram(java.util.List<Annotation> annotations)
          Creates a pitch class histogram directly from a list of annotations (without kernels).
static PitchClassHistogram createPitchClassHistogram(java.util.List<Annotation> annotations, double width)
          Create a tone scale histogram using a kernel instead of an ordinary count.
static PitchClassHistogram createPitchClassHistogram(ScalaFile scalaFile)
          Builds a pitch class histogram using the pitches defined in a scala file.
static PitchHistogram createPitchHistogram(java.util.List<Annotation> annotations)
          Create a pitch histogram based on a list of annotations.
static PitchHistogram createPitchHistogram(java.util.List<Annotation> annotations, double width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createPitchClassHistogram

public static PitchClassHistogram createPitchClassHistogram(java.util.List<Annotation> annotations)
Creates a pitch class histogram directly from a list of annotations (without kernels).

Parameters:
annotations - The list of annotations.
Returns:
A pitch class histogram with the annotations added.

createPitchClassHistogram

public static PitchClassHistogram createPitchClassHistogram(KernelDensityEstimate kde)
Creates a pitch class histogram directly from a list of annotations (without kernels).

Parameters:
kde -
Returns:
A pitch class histogram with the annotations added.

createPitchClassHistogram

public static PitchClassHistogram createPitchClassHistogram(java.util.List<Annotation> annotations,
                                                            double width)
Create a tone scale histogram using a kernel instead of an ordinary count. This construction uses a paradigm described here: http://en.wikipedia.org/wiki/Kernel_density_estimation It uses Gaussian kernels of a defined width. The width should be around the just noticeable threshold of about 7 cents.

Parameters:
annotations - A list of annotations.s
width - The with of the kernel in cents.
Returns:
A histogram build with Gaussian kernels.

createPitchClassHistogram

public static PitchClassHistogram createPitchClassHistogram(ScalaFile scalaFile)
Builds a pitch class histogram using the pitches defined in a scala file. It uses Gaussian kernels.

Parameters:
scalaFile -
Returns:
A PitchClassHistogram built with Gaussian kernels on the pitches defined in the file.

createMaxPitchClassHistogram

public static PitchClassHistogram createMaxPitchClassHistogram(java.util.List<Annotation> annotations,
                                                               double duration,
                                                               TimeUnit unit)
Create a pitch class histogram by taking the maximum number of annotations for a defined time window. This should make lesser used pitch classes more prominently visible.

Parameters:
annotations - The original list of annotations.
duration - The duration for one window (define in the unit)
unit - The uint for the duration.
Returns:
A pitch class histogram containing the maximum in a window.

createPitchHistogram

public static PitchHistogram createPitchHistogram(java.util.List<Annotation> annotations)
Create a pitch histogram based on a list of annotations.

Parameters:
annotations - A list of annotations.
Returns:
a pitch class histogram with the annotations added.

createPitchHistogram

public static PitchHistogram createPitchHistogram(java.util.List<Annotation> annotations,
                                                  double width)

createPichClassKDE

public static KernelDensityEstimate createPichClassKDE(java.util.List<Annotation> annotations,
                                                       double width)
Creates a pitch class KernelDensityEstimate for a list of annotations.

Parameters:
annotations - A list of annotations.
width - The width of the Gaussian kernel.
Returns:
A kernel density estimate with the annotations added.

createPichClassKDE

public static KernelDensityEstimate createPichClassKDE(ScalaFile scalaFile,
                                                       double width)
Creates a pitch class KernelDensityEstimate for a list of pitches defined by a Scala file.

Parameters:
scalaFile - A Scala file, defining a list of pitches.
width - The width of the Gaussian kernel.
Returns:
A kernel density estimate with the annotations added.

createPichClassKDE

public static KernelDensityEstimate createPichClassKDE(java.util.List<Annotation> annotations,
                                                       double width,
                                                       double windowDuration)
Creates a pitch class KernelDensityEstimate for a list of pitches defined by the annotations.

Parameters:
width - The width of the Gaussian kernel.
annotations - A list of annotations.
windowDuration - The duration for one window in seconds.
Returns:
A kernel density estimate with the annotations added.