Package de.saar.coli.arranger
Class Chord
- java.lang.Object
-
- de.saar.coli.arranger.Chord
-
public class Chord extends Object
A chord rooted in a specific note. Each chord is defined by itsChord.ChordType, such as "seventh" or "minor sixth", and its root note. The class offers methods for accessing the notes in the chord.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChord.ChordTypeA chord type, such as "major" or "minor sixth".
-
Constructor Summary
Constructors Constructor Description Chord()
-
Method Summary
Modifier and Type Method Description booleanequals(Object o)KeygetKey()Returns the key to which this chord belongs.Set<Integer>getNotes()Returns the notes of the chord, as relative notes in the sense ofNote.intgetRoot()Returns the root note of the chord, as a relative note in the sense ofNote.Chord.ChordTypegetType()Returns the type of this chord.inthashCode()booleanisAllowedBassNote(Note note)Checks if the given note is allowed in the bass part of this chord.static Chordlookup(String chordName)Looks up a chord based on its name, such as "Cmj7".static Chordlookup(String root, Chord.ChordType type)Looks up a chord based on its root note and its chord type.StringtoString()
-
-
-
Method Detail
-
lookup
public static Chord lookup(String root, Chord.ChordType type)
Looks up a chord based on its root note and its chord type.- Parameters:
root-type-- Returns:
-
lookup
public static Chord lookup(String chordName)
Looks up a chord based on its name, such as "Cmj7".- Parameters:
chordName-- Returns:
-
getNotes
public Set<Integer> getNotes()
Returns the notes of the chord, as relative notes in the sense ofNote.- Returns:
-
isAllowedBassNote
public boolean isAllowedBassNote(Note note)
Checks if the given note is allowed in the bass part of this chord.- Parameters:
note-- Returns:
-
getKey
public Key getKey()
Returns the key to which this chord belongs. This is a combination of the chord's root and its mode, as perChord.ChordType.getMode(). Thus, the Cmaj7 chord is mapped to the key of C major, and the Am6 chord is mapped to the key of A minor. These keys can be used to spell the accidentals in the chord correctly.- Returns:
-
getRoot
public int getRoot()
Returns the root note of the chord, as a relative note in the sense ofNote.- Returns:
-
getType
public Chord.ChordType getType()
Returns the type of this chord.- Returns:
-
-