uk.org.toot.music.tonality
Class Chords

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

public class Chords
extends java.lang.Object

This class is effectively a database of known chords with static methods to retrieve particular chords. A Chord can be retrieved by symbol, spelling, name and intervals. Chords can also be identified from notes.

Author:
st

Nested Class Summary
static class Chords.DefaultIdentifier
          The DefaultIdentifier class provides the default implementation of withNotes(int[] notes) for Chord identification.
static interface Chords.Identifier
          The Identifier inner interface specified the contract for the class that implements withNotes(int[] notes) for Chord identification.
 
Method Summary
static void add(Chord aChord)
          Add a Chord to the list of known chords.
static void addChord(java.lang.String aSymbol, java.lang.String aSpelling, java.lang.String aName)
          Add a new Chord to the list of known chords.
static void checkIdentifiability()
          Check all known Chords can be properly identified.
static java.util.List<Chord> fromChordMode(int[] chordMode)
          Return the List of Chords which are derived from the specifed chord mode.
static void setChordIdentifer(Chords.Identifier identifier)
          Permit an alternate Identifier to be plugged in in case DefaultIdentifier is unsuitable.
static Chord withIntervals(int[] someIntervals)
          Return the single Chord with the specified intervals
static java.util.List<Chord.Voicing> withIntervals(int[] someIntervals, int missing)
          Return the List of Chord.Voicings with the specified intervals but with exactly 'missing' missing intervals.
static Chord withName(java.lang.String aName)
          Return the single Chord with the specified name.
static java.util.List<Chord.PitchedVoicing> withNotes(int[] notes)
          Return the List of Chord.PitchedVoicings with the specified notes
static Chord withSpelling(java.lang.String aSpelling)
          Return the single Chord that has the specified spelling.
static Chord withSymbol(java.lang.String aSymbol)
          Return the single Chord that has the specified symbol.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setChordIdentifer

public static void setChordIdentifer(Chords.Identifier identifier)
Permit an alternate Identifier to be plugged in in case DefaultIdentifier is unsuitable.

Parameters:
identifier - the Identifier to use to implement withNotes(int[] notes)

add

public static void add(Chord aChord)
Add a Chord to the list of known chords.

Parameters:
aChord - the Chord to add

addChord

public static void addChord(java.lang.String aSymbol,
                            java.lang.String aSpelling,
                            java.lang.String aName)
Add a new Chord to the list of known chords.

Parameters:
aSymbol - the symbol of the Chord to be added
aSpelling - the spelling of the Chord to be added
aName - the name of the Cohord to be added

withSymbol

public static Chord withSymbol(java.lang.String aSymbol)
Return the single Chord that has the specified symbol.

Parameters:
aSymbol - the specified symbol to find
Returns:
the Chord if found, null otherwise

withSpelling

public static Chord withSpelling(java.lang.String aSpelling)
Return the single Chord that has the specified spelling.

Parameters:
aSpelling - the specified spelling to find
Returns:
the Chord if found, null otherwise

withName

public static Chord withName(java.lang.String aName)
Return the single Chord with the specified name.

Parameters:
aName - the specified name to find
Returns:
the Chord if found, null otherwise

withIntervals

public static Chord withIntervals(int[] someIntervals)
Return the single Chord with the specified intervals

Parameters:
someIntervals -
Returns:
the Chord if found, null otherwise

withIntervals

public static java.util.List<Chord.Voicing> withIntervals(int[] someIntervals,
                                                          int missing)
Return the List of Chord.Voicings with the specified intervals but with exactly 'missing' missing intervals.

Parameters:
someIntervals -
missing - the number of intervals that must be missing
Returns:
the List of Chord.Voicings

withNotes

public static java.util.List<Chord.PitchedVoicing> withNotes(int[] notes)
Return the List of Chord.PitchedVoicings with the specified notes

Parameters:
notes - the notes or pitches
Returns:
the List of Chord.PitchedVoicings which match the notes

fromChordMode

public static java.util.List<Chord> fromChordMode(int[] chordMode)
Return the List of Chords which are derived from the specifed chord mode.

Parameters:
chordMode -
Returns:
the List of Chords

checkIdentifiability

public static void checkIdentifiability()
Check all known Chords can be properly identified.



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