|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object world.sound.tunes.Chord
public class Chord
A class to represent a collection of notes to be played on one instrument at the same time. Individual notes do not need to have the same duration. Based in part on a class originally designed by Viera K. Proulx.
Field Summary | |
---|---|
static int |
DEFAULT_DUR
The default Note duration. |
static Chord |
noplay
A singleton Chord representing silence |
java.util.ArrayList<Note> |
notes
the list of notes in this chord |
Constructor Summary | |
---|---|
Chord()
The default constructor |
|
Chord(int... pitches)
Creates a Chord from a sequence of Pitches (Note numbers) |
|
Chord(Note... notes)
Create a Chord from a sequence of Notes. |
Method Summary | |
---|---|
void |
addNote(int pitch,
int duration)
Add a Note with the given pitch and duration to this Chord. |
void |
addNote(Note n)
Add a given note to this Chord. |
boolean |
containsNote(Note note)
Does this chord contain the given note? |
Chord |
copy()
Make a copy of this Chord by copying its Notes |
boolean |
isSilent()
Have all notes in this chord finish playing? |
Chord |
nextBeat()
Reduce all the Notes in this Chord by a single beat. |
int |
size()
Get the number of Notes in this Chord. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_DUR
public java.util.ArrayList<Note> notes
public static final Chord noplay
Constructor Detail |
---|
public Chord()
public Chord(int... pitches)
public Chord(Note... notes)
Method Detail |
---|
public void addNote(Note n)
public void addNote(int pitch, int duration)
public Chord nextBeat()
public boolean isSilent()
public Chord copy()
public int size()
public boolean containsNote(Note note)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |