sky.monome.util.scale
Class ScaleFactory


java.lang.Object

  extended by sky.monome.util.scale.ScaleFactory


public final class ScaleFactory
extends java.lang.Object

Scale factory. This ininstanciable class is only a set of convenience methods to create various common musical scales.

Since:
SkyMonome v1.1
Author:
PJ Skyman

Field Summary
static java.util.Comparator<Scale> INTERVAL_SUM_COMPARATOR
          A comparator for scales that will sort scales by interval sum.
static java.util.Comparator<Scale> NAME_COMPARATOR
          A comparator for scales that will sort scales alphabetically.
static java.util.Comparator<Scale> NOTES_NUMBER_IN_OCTAVE_COMPARATOR
          A comparator for scales that will sort scales by notes number in octave.
 
Method Summary
static Scale createAeolianScale()
          Returns an aeolian scale.
static Scale createBluesPentatonicScale()
          Returns a blues pentatonic scale.
static Scale createBluesScale()
          Returns a blues scale.
static Scale createDiatonicScale()
          Returns a diatonic scale.
static Scale createDorianScale()
          Returns a dorian scale.
static Scale createHarmonicMinorScale()
          Returns a harmonic minor scale.
static Scale createIonianScale()
          Returns an ionian scale.
static Scale createLocrianScale()
          Returns a locrian scale.
static Scale createLydianScale()
          Returns a lydian scale.
static Scale createMajorPentatonicScale()
          Returns a major pentatonic scale.
static Scale createMajorScale()
          Returns a major scale.
static Scale createMelodicMinorScale()
          Returns a melodic minor scale.
static Scale createMinorPentatonicScale()
          Returns a minor pentatonic scale.
static Scale createMinorScale()
          Returns a minor scale.
static Scale createMixolydianScale()
          Returns a mixolydian scale.
static Scale createPhrygianScale()
          Returns a phrygian scale.
static Scale[] getAllScales()
          Returns an array of all existing scales sorted in an arbitrary order.
static Scale[] getAllScales(java.util.Comparator<? super Scale>... comparators)
          Returns a sorted array of all existing scales.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_COMPARATOR


public static final java.util.Comparator<Scale> NAME_COMPARATOR
A comparator for scales that will sort scales alphabetically.

Since:
SkyMonome v1.2

NOTES_NUMBER_IN_OCTAVE_COMPARATOR


public static final java.util.Comparator<Scale> NOTES_NUMBER_IN_OCTAVE_COMPARATOR
A comparator for scales that will sort scales by notes number in octave.

Since:
SkyMonome v1.2

INTERVAL_SUM_COMPARATOR


public static final java.util.Comparator<Scale> INTERVAL_SUM_COMPARATOR
A comparator for scales that will sort scales by interval sum.

Since:
SkyMonome v1.2
Method Detail

createMajorScale


public static Scale createMajorScale()
Returns a major scale.

Returns:
A major scale.

createMinorScale


public static Scale createMinorScale()
Returns a minor scale.

Returns:
A minor scale.

createHarmonicMinorScale


public static Scale createHarmonicMinorScale()
Returns a harmonic minor scale.

Returns:
A harmonic minor scale.

createMelodicMinorScale


public static Scale createMelodicMinorScale()
Returns a melodic minor scale.

Returns:
A melodic minor scale.

createMajorPentatonicScale


public static Scale createMajorPentatonicScale()
Returns a major pentatonic scale.

Returns:
A major pentatonic scale.

createMinorPentatonicScale


public static Scale createMinorPentatonicScale()
Returns a minor pentatonic scale.

Returns:
A minor pentatonic scale.

createBluesPentatonicScale


public static Scale createBluesPentatonicScale()
Returns a blues pentatonic scale.

Returns:
A blues pentatonic scale.

createIonianScale


public static Scale createIonianScale()
Returns an ionian scale.

Returns:
An ionian scale.

createAeolianScale


public static Scale createAeolianScale()
Returns an aeolian scale.

Returns:
An aeolian scale.

createDorianScale


public static Scale createDorianScale()
Returns a dorian scale.

Returns:
A dorian scale.

createMixolydianScale


public static Scale createMixolydianScale()
Returns a mixolydian scale.

Returns:
A mixolydian scale.

createPhrygianScale


public static Scale createPhrygianScale()
Returns a phrygian scale.

Returns:
A phrygian scale.

createLydianScale


public static Scale createLydianScale()
Returns a lydian scale.

Returns:
A lydian scale.

createLocrianScale


public static Scale createLocrianScale()
Returns a locrian scale.

Returns:
A locrian scale.

createBluesScale


public static Scale createBluesScale()
Returns a blues scale.

Returns:
A blues scale.

createDiatonicScale


public static Scale createDiatonicScale()
Returns a diatonic scale.

Returns:
A diatonic scale.

getAllScales


public static Scale[] getAllScales()
Returns an array of all existing scales sorted in an arbitrary order. The returned array is dynamically calculated by reflection.

Returns:
An array of all existing scales.
Since:
SkyMonome v1.2

getAllScales


public static Scale[] getAllScales(java.util.Comparator<? super Scale>... comparators)
Returns a sorted array of all existing scales. The order of the scales in the returned array is defined by specified comparators (you can specify just one comparator). Note that the last comparator is the last applied. So if you need to sort by notes number in octave and then alphabetically for those that have the same notes number, you must specify firstly the comparator for names (the least important), and secondly the comparator for notes numbers in octave (the most important).

Parameters:
comparators - Comparators of scales that will sort scales in the returned array.
Returns:
A sorted array of all existing scales.
Since:
SkyMonome v1.2