Package org.ptolemy.machineImprovisation
Class Chord
- java.lang.Object
-
- org.ptolemy.machineImprovisation.Chord
-
public class Chord extends java.lang.Object
A class that defines a Chord object. A chord is either given by a set of notes that it contains, or a name. In the latter case, the notes contained by the chord can be retrieved by a local library, currently defined inMusicSpecs
.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Ilge Akkaya
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (ilgea)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNote(Note n)
Add a note to this chord.double
getDuration()
Get the duration of this Chord.java.lang.String
getName()
Get name of this Chord.java.util.Set<Note>
getNotes()
Get notes contained by this Chord.void
setChordTones()
Set the notes contained by this chord by a dictionary lookup.void
setChordTones(java.lang.String chord)
Set the notes contained by this chord, by name reference.
-
-
-
Constructor Detail
-
Chord
public Chord(java.lang.String name, double duration)
Construct a chord with a name and a duration.- Parameters:
name
- Chord nameduration
- Chord duration
-
Chord
public Chord(java.util.Set<Note> chordTones)
Construct a chord by a set of note objects.- Parameters:
chordTones
- a Set of notes that are a part of the specified Chord.
-
Chord
public Chord()
Construct an empty Chord with no chord tones.
-
-
Method Detail
-
addNote
public void addNote(Note n)
Add a note to this chord.- Parameters:
n
- Note to be added
-
getNotes
public java.util.Set<Note> getNotes()
Get notes contained by this Chord.- Returns:
- the Set of chord tones contained by this chord
-
getDuration
public double getDuration()
Get the duration of this Chord.- Returns:
- duration of chord
-
getName
public java.lang.String getName()
Get name of this Chord.- Returns:
- Chord name
-
setChordTones
public void setChordTones() throws IllegalActionException
Set the notes contained by this chord by a dictionary lookup.- Throws:
IllegalActionException
- If the chord name is undefined.
-
setChordTones
public void setChordTones(java.lang.String chord)
Set the notes contained by this chord, by name reference.- Parameters:
chord
- The chord name
-
-