Class StandardScaleInstance

java.lang.Object
org.jjazz.harmony.api.StandardScaleInstance
All Implemented Interfaces:
Serializable

public class StandardScaleInstance extends Object implements Serializable
A standard scale (e.g. Mixolydian) with a start note (e.g. Eb).

This is an immutable class.

See Also:
  • Constructor Details

    • StandardScaleInstance

      public StandardScaleInstance(StandardScale scale, Note startNote)
  • Method Details

    • getScale

      public StandardScale getScale()
    • getStartNote

      public Note getStartNote()
    • getTransposed

      public StandardScaleInstance getTransposed(int semitons)
      Return a copy transposed by t semitons.
      Parameters:
      semitons -
      Returns:
    • getNotes

      public List<Note> getNotes()
      Get the notes that make the scale.
      Returns:
    • getRelativePitches

      public List<Integer> getRelativePitches()
      Get the relative pitches of the notes that make the scale.
      Returns:
      An unmodifiable list.
    • fitDegree

      public Degree fitDegree(Degree d)
      Try to fit d to this scale.

      1/ If d.getPitch() is part of this scale return the corresponding degree

      Ex: d=NINTH_SHARP and scale=DORIAN, return THIRD_MINOR (same pitch)

      2/ If 1/ dit not work, try to see a derived degree match

      Ex: d=FIFTH and scale=ALTERED, return FIFTH_FLAT

      Parameters:
      d -
      Returns:
      A matching degree which belongs to this scale, or null.
    • equals

      public boolean equals(Object o)
      Equals if same scale object and same relative pitch for start notes.
      Overrides:
      equals in class Object
      Parameters:
      o -
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toNoteString

      public String toNoteString()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fitDegree

      public static Degree fitDegree(Degree d, StandardScaleInstance... ssis)
      Call fitDegree(d) on each of the StandardScaleInstance and return the first non-null result.
      Parameters:
      d -
      ssis -
      Returns:
      Can be null.