|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
uk.org.toot.music.tonality.Key
public class Key
A Key has a root pitch class and a Scale It does not have a register. It is Observable to simplify modulation
Nested Class Summary | |
---|---|
static interface |
Key.Provider
A Provider provides a mutable Key for Observers to observe. |
Constructor Summary | |
---|---|
Key()
|
|
Key(int root)
|
|
Key(int root,
Scale scale)
Constructor |
|
Key(java.lang.String root,
Scale scale)
|
Method Summary | |
---|---|
boolean |
contains(int pitch)
Return whether this Key contains the specified pitch. |
boolean |
contains(int[] pitches)
Return whether this Key contains all the specified pitches. |
int |
diatonicPitch(int pitch)
Returns the nearest diatonic pitch, preference to lower |
boolean |
equals(java.lang.Object o)
|
int[] |
getChordNotes(int index,
int poly,
int lowInterval)
Return the notes of a chord with specified polyphony and interval. |
java.lang.String[] |
getNames()
Get the note names for this Key |
int |
getNote(int index)
Return the note derived from the index into the Key. |
int |
getRelativePitch(int pitch,
int offset)
|
int |
getRoot()
Get the root pitch class of this Key. |
Scale |
getScale()
Get the Scale for this Key. |
int |
index(int pitch)
Return the index of a pitch into this Key's Scale, effectively a linear measure of the degree. |
java.lang.String |
name()
Return the name of this Key as root note (pitch class) and Scale. |
java.lang.String |
name(int index)
Return the name of a note indexed into the Key |
void |
setNames(java.lang.String[] names)
Set the not names for this Key. |
void |
setRoot(int root)
Set the root pitch class for this Key and notify Observers. |
void |
setScale(Scale scale)
Set the Scale for this Key and notify Observers. |
java.lang.String |
toString()
Return the name of this Key, e.g. |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Key(int root, Scale scale)
public Key(java.lang.String root, Scale scale)
public Key(int root)
public Key()
Method Detail |
---|
public boolean contains(int[] pitches)
pitches
- the array of int values of the pitches
public boolean contains(int pitch)
pitch
- the int value of the pitch
public int index(int pitch)
pitch
- the int value of the pitch
public java.lang.String[] getNames()
public void setNames(java.lang.String[] names)
public int getRoot()
public void setRoot(int root)
root
- the new root pitch class for this keypublic Scale getScale()
public void setScale(Scale scale)
scale
- the new Scale for this Key.public int diatonicPitch(int pitch)
pitch
- the possibly non-diatonic pitch
public int getRelativePitch(int pitch, int offset)
public int getNote(int index)
index
- the index into the Key's Scale
public int[] getChordNotes(int index, int poly, int lowInterval)
index
- the index into the Key's Scalepoly
- the number of notes, 2 .. 7lowInterval
- ChordMode.SECUNDAL, ChordMode.TERTIARY or ChordMode.QUARTAL
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String name()
public java.lang.String name(int index)
index
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |