be.hogent.tarsos.util
Class ScalaFile

java.lang.Object
  extended by be.hogent.tarsos.util.ScalaFile

public final class ScalaFile
extends java.lang.Object

A representation of a scala file. See the Scala scale file format.

Author:
Joren Six

Constructor Summary
ScalaFile(java.lang.String scalaFile)
          Reads a Scala file from disk and returns a new instance.
ScalaFile(java.lang.String desc, double[] notes)
          Create a new Scala file object.
ScalaFile(java.lang.String desc, double[] notes, java.lang.String[] names)
          Create a new Scala file object.
 
Method Summary
 ScalaFile findClosest(java.util.List<ScalaFile> haystack)
          In a list of scala files it finds the closest one.
 java.lang.String getDescription()
           
 double[] getPitches()
           
 java.lang.String[] getPitchNames()
           
 boolean hasNames()
           
 void setDescription(java.lang.String newDescription)
           
static ScalaFile westernTuning()
           
 void write(java.lang.String scalaFile)
          Writes a Scala file to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalaFile

public ScalaFile(java.lang.String desc,
                 double[] notes,
                 java.lang.String[] names)
Create a new Scala file object.

Parameters:
desc - The description of the tone scale.
notes - The pitches (notes) used in the scale.
names - The names of the notes used (or null).

ScalaFile

public ScalaFile(java.lang.String desc,
                 double[] notes)
Create a new Scala file object.

Parameters:
desc - The description of the tone scale.
notes - The pitches (notes) used in the scale.

ScalaFile

public ScalaFile(java.lang.String scalaFile)
Reads a Scala file from disk and returns a new instance.

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.

Usually it has .scl as extension.

Parameters:
scalaFile - The Scala file to read.
Method Detail

write

public void write(java.lang.String scalaFile)
Writes a Scala file to disk. The peaks use cent values.

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.

Usually it has .scl as extension.

Parameters:
scalaFile - The location to write to.

getPitches

public double[] getPitches()
Returns:
The list of pitches. It returns a clone so please cache appropriately.

getDescription

public java.lang.String getDescription()
Returns:
The tone scale description.

setDescription

public void setDescription(java.lang.String newDescription)

getPitchNames

public java.lang.String[] getPitchNames()
Returns:
A list of pitch names. Or null.

hasNames

public boolean hasNames()
Returns:
True if the pitch classes are named, false otherwise.

westernTuning

public static ScalaFile westernTuning()
Returns:
The western scale.

findClosest

public ScalaFile findClosest(java.util.List<ScalaFile> haystack)
In a list of scala files it finds the closest one. This is currently defined by histogram overlap.

Parameters:
haystack - a list of Scala files.
Returns:
the closest Scala file.