Class Chord

java.lang.Object
org.jfugue.theory.Chord
All Implemented Interfaces:
PatternProducer

public class Chord extends Object implements PatternProducer
  • Field Details

    • chordMap

      public static Map<String,Intervals> chordMap
    • humanReadableMap

      public static Map<String,String> humanReadableMap
    • MAJOR_INTERVALS

      public static final Intervals MAJOR_INTERVALS
    • MINOR_INTERVALS

      public static final Intervals MINOR_INTERVALS
    • DIMINISHED_INTERVALS

      public static final Intervals DIMINISHED_INTERVALS
    • MAJOR_SEVENTH_INTERVALS

      public static final Intervals MAJOR_SEVENTH_INTERVALS
    • MINOR_SEVENTH_INTERVALS

      public static final Intervals MINOR_SEVENTH_INTERVALS
    • DIMINISHED_SEVENTH_INTERVALS

      public static final Intervals DIMINISHED_SEVENTH_INTERVALS
    • MAJOR_SEVENTH_SIXTH_INTERVALS

      public static final Intervals MAJOR_SEVENTH_SIXTH_INTERVALS
    • MINOR_SEVENTH_SIXTH_INTERVALS

      public static final Intervals MINOR_SEVENTH_SIXTH_INTERVALS
  • Constructor Details

    • Chord

      public Chord(String s)
    • Chord

      public Chord(Chord chord)
    • Chord

      public Chord(Note root, Intervals intervals)
    • Chord

      public Chord(Key key)
  • Method Details

    • getChordNames

      public static String[] getChordNames()
    • addChord

      public static void addChord(String name, String intervalPattern)
    • addChord

      public static void addChord(String name, Intervals intervalPattern)
    • getIntervals

      public static Intervals getIntervals(String name)
    • removeChord

      public static void removeChord(String name)
    • getChordType

      public static String getChordType(Intervals intervals)
    • putHumanReadable

      public static void putHumanReadable(String chordName, String humanReadableName)
    • getHumanReadableName

      public static String getHumanReadableName(String chordName)
      Returns a human readable chord name if one exists, otherwise returns the same chord name that was passed in
    • isValidChord

      public static boolean isValidChord(String candidateChordMusicString)
      Returns true if the passed string contains a note, a known chord, and optionally an octave or duration.
    • fromNotes

      public static Chord fromNotes(String noteString)
    • fromNotes

      public static Chord fromNotes(String[] noteStrings)
    • fromNotes

      public static Chord fromNotes(Note[] notes)
    • getRoot

      public Note getRoot()
    • getIntervals

      public Intervals getIntervals()
    • getInversion

      public int getInversion()
    • setInversion

      public Chord setInversion(int nth)
    • setBassNote

      public Chord setBassNote(String newBass)
      See Also:
    • setBassNote

      public Chord setBassNote(Note newBass)
      Although setBassNote takes a Note, it doesn't just set a local value to the incoming note. Instead, it uses the incoming note to compute the inversion for this chord, and sets the inversion. getBassNote() reconstructs the bass note using the inversion. If the rootNote is null, this method returns without taking any action.
    • getBassNote

      public Note getBassNote()
    • setOctave

      public Chord setOctave(int octave)
    • getNotes

      public Note[] getNotes()
    • getChordType

      public String getChordType()
    • getInversionFromChordString

      public static int getInversionFromChordString(String chordString)
      Returns a count of the number of carets at the end of the chord string. Given Cmaj^^, this will return 2.
    • getPattern

      public Pattern getPattern()
      Description copied from interface: PatternProducer
      Returns a pattern
      Specified by:
      getPattern in interface PatternProducer
    • getPatternWithNotes

      public Pattern getPatternWithNotes()
    • getPatternWithNotesExceptRoot

      public Pattern getPatternWithNotesExceptRoot()
    • getPatternWithNotesExceptBass

      public Pattern getPatternWithNotesExceptBass()
    • isMajor

      public boolean isMajor()
    • isMinor

      public boolean isMinor()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

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

      public String toNoteString()
      Returns a string consisting of the notes in the chord. For example, new Chord("Cmaj").toNoteString() returns "(C+E+G)" TODO: Update with Java 8 String Joiner
    • toHumanReadableString

      public String toHumanReadableString()
    • toDebugString

      public String toDebugString()