uk.org.toot.music.tonality
Class Scale

java.lang.Object
  extended by uk.org.toot.music.tonality.Scale

public class Scale
extends java.lang.Object

A Scale is a list of intervals. Melodies are derived from a scale. Chords are derived from the modes of a scale, aka chord modes.

Author:
st

Constructor Summary
Scale(java.lang.String name, int[] intervals)
          Constructor
 
Method Summary
 int[] getChordMode(int index)
          Derive the Chord Mode for the specified index into this Scale.
 int[] getIntervals()
           
 int getIntervalsAsInt()
           
 java.lang.String getName()
           
 boolean hasInterval(int index, int val)
           
 int interval(int index)
          Return the interval of the specified index into this Scale.
 int interval(int index1, int index2)
          Return the interval between the specified indices into this Scale.
 int length()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scale

public Scale(java.lang.String name,
             int[] intervals)
Constructor

Method Detail

length

public int length()
Returns:
the length of this Scale.

getName

public java.lang.String getName()
Returns:
the name of this Scale.

getIntervals

public int[] getIntervals()
Returns:
the intervals of this Scale.

getIntervalsAsInt

public int getIntervalsAsInt()
Returns:
the intervals of this Scale as a bitmask.

interval

public int interval(int index)
Return the interval of the specified index into this Scale.

Parameters:
index - the index into this Scale.
Returns:
the indexed interval

interval

public int interval(int index1,
                    int index2)
Return the interval between the specified indices into this Scale. If index2 is less than index1, the interval for index2 is raised by an octave so that modes of the scale (rotations) can be derived easily by getChordMode().

Parameters:
index1 - the index of the lower interval
index2 - the index of the higher interval
Returns:
the interval between the specified indices

getChordMode

public int[] getChordMode(int index)
Derive the Chord Mode for the specified index into this Scale.

Parameters:
index - the index into this Scale
Returns:
the array of intervals representing the chord mode

hasInterval

public boolean hasInterval(int index,
                           int val)
Returns:
true if interval is diatonic from this index, false otherwise


Copyright © 2004, 2005, 2006, 2007 Steve Taylor. All Rights Reserved.