be.hogent.tarsos.util.histogram
Class PitchClassHistogram

java.lang.Object
  extended by be.hogent.tarsos.util.histogram.Histogram
      extended by be.hogent.tarsos.util.histogram.PitchClassHistogram
All Implemented Interfaces:
java.lang.Cloneable

public final class PitchClassHistogram
extends Histogram

Author:
Joren Six Create a new tone scale. A tone scale is defined as a wrapping histogram with values from 0 to 1200 cents.
Warning: some exotic 'tone scales' span more than one octave these will be folded to one octave. E.g.
 ! mambuti.scl
 !
 African Mambuti Flutes (aerophone; vertical wooden; one note each)
 8
 !
  204.000 cents
  411.000 cents
  710.000 cents
 1000.000 cents
 1206.000 cents
 1409.000 cents
 1918.000 cents
 2321.001 cents
 

Would be (mistakenly?) represented as:
    6.000 cents (1206 - 1200)
  204.000 cents                |
  209.000 cents (1409 - 1200)  |
  411.000 cents
  710.000 cents                |
  718.000 cents (1918 - 1200)  |
 1000.000 cents
 1121.001 cents (2321 - 1200)
 
The scala scale archive is a collection of 3772 scales; 424 of which do not end on an octave (mostly ambitus descriptions of an instrument).

Constructor Summary
PitchClassHistogram()
          Create a new tone scale using the configured bin width.
 
Method Summary
static PitchClassHistogram createToneScale(double[] peaks)
           
static PitchClassHistogram createToneScale(double[] peaks, double[] heights)
           
static PitchClassHistogram createToneScale(double[] peaks, double[] heights, double[] widths)
           
static PitchClassHistogram createToneScale(double[] peaks, double[] heights, double[] widths, double[] standardDeviations)
          Creates a theoretical tone scale using a mixture of Gaussian functions See an automatic pitch analysis method for Turkish maqam music.
static void exportPeaksToScalaFileFormat(java.lang.String fileName, java.lang.String toneScaleName, java.util.List<Peak> peaks)
          Saves the scale in the Scala scale file format: This file format for musical tunings is becoming a standard for exchange of scales, owing to the size of the scale archive of over 3700+ scales and the popularity of the Scala program.
 void exportToScalaScaleFileFormat(java.lang.String fileName, java.lang.String toneScaleName)
          Executes peak detection on this histogram and saves the scale in the Scala scale file format: This file format for musical tunings is becoming a standard for exchange of scales, owing to the size of the scale archive of over 3700+ scales and the popularity of the Scala program.
 boolean isMelodic()
          Checks if the tone scale is "melodic": it has one or more clearly defined peaks.
 
Methods inherited from class be.hogent.tarsos.util.histogram.Histogram
add, add, add, addToEachBin, baselineHistogram, clear, clone, correlation, correlation, correlationWithDisplacement, correlationWithDisplacement, displace, displacementForOptimalCorrelation, displacementForOptimalCorrelation, export, exportMatLab, gaussianSmooth, getAbsoluteSumFreq, getClassWidth, getCount, getCountForClass, getCumFreq, getCumPct, getEntropy, getKeyForClass, getMaxBinCount, getMean, getMedian, getNumberOfClasses, getPct, getStart, getStop, getSumFreq, invert, isWrapped, keySet, max, mean, multiply, normalize, plot, plotCorrelation, raise, setCount, smooth, subtract, toString, toString, valueAddedHook
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PitchClassHistogram

public PitchClassHistogram()
Create a new tone scale using the configured bin width. A tone scale is a wrapping histogram with values from 0 to 1200 cents.

Method Detail

exportToScalaScaleFileFormat

public void exportToScalaScaleFileFormat(java.lang.String fileName,
                                         java.lang.String toneScaleName)
Executes peak detection on this histogram and saves the scale in the Scala scale file format: This file format for musical tunings is becoming a standard for exchange of scales, owing to the size of the scale archive of over 3700+ scales and the popularity of the Scala program.

Parameters:
fileName - The scala file name.
toneScaleName - The name of the tone scale.

exportPeaksToScalaFileFormat

public static void exportPeaksToScalaFileFormat(java.lang.String fileName,
                                                java.lang.String toneScaleName,
                                                java.util.List<Peak> peaks)
Saves the scale in the Scala scale file format: This file format for musical tunings is becoming a standard for exchange of scales, owing to the size of the scale archive of over 3700+ scales and the popularity of the Scala program.

Parameters:
fileName -
toneScaleName -
peaks -

createToneScale

public static PitchClassHistogram createToneScale(double[] peaks)

createToneScale

public static PitchClassHistogram createToneScale(double[] peaks,
                                                  double[] heights)

createToneScale

public static PitchClassHistogram createToneScale(double[] peaks,
                                                  double[] heights,
                                                  double[] widths)

createToneScale

public static PitchClassHistogram createToneScale(double[] peaks,
                                                  double[] heights,
                                                  double[] widths,
                                                  double[] standardDeviations)
Creates a theoretical tone scale using a mixture of Gaussian functions See an automatic pitch analysis method for Turkish maqam music. The theoretic scale can be used to search for similar tone scales using histogram correlation.

Parameters:
peaks - the position of the peaks. The position is defined in cents.
heights - the heights of the peaks. If null the heights for all peaks is 200.
widths - the widths of the peaks in cents. If null the width is 25 cents for all peaks. The width is measured at a certain height. The mean?
standardDeviations - defines the shape of the peak. If null the standard deviation is 1. Bigger values give a wider peak.
Returns:
a histogram with values from 0 to 1200 and the requested peaks.

isMelodic

public boolean isMelodic()
Checks if the tone scale is "melodic": it has one or more clearly defined peaks. Talking people, noise or other random sounds are not melodic.

Returns:
true if the tone scale has clearly defined peaks, false otherwise.