|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfugue.Note
public class Note
Contains all information necessary for a musical note, including pitch, duration, attack velocity, and decay velocity.
Most of these settings have defaults. The default octave is 5. The default duration is a quarter note. The default attack and decay velocities are 64.
Field Summary | |
---|---|
static byte |
DEFAULT_VELOCITY
Default value for attack and decay velocity. |
static byte |
FIRST
Indicates that this note is the first note in the token. |
static java.lang.String[] |
NOTES
|
static byte |
PARALLEL
Indicates that this note is played at the same time as a previous note in the same token. |
static byte |
SEQUENTIAL
Indicates that this note immediately follows a previous note in the same token. |
Constructor Summary | |
---|---|
Note()
Instantiates a new Note object. |
|
Note(byte value,
long duration)
Instantiates a new Note object with the given note value and duration. |
Method Summary | |
---|---|
byte |
getAttackVelocity()
Returns the attack velocity for this note. |
byte |
getDecayVelocity()
Returns the decay velocity for this note. |
double |
getDecimalDuration()
Returns the decimal fraction value for the duration. |
long |
getDuration()
Returns the duration of this note. |
java.lang.String |
getMusicString()
Returns the Music String representing this element and all of its settings. |
static java.lang.String |
getStringForDuration(double decimalDuration)
Returns a MusicString representation of a decimal duration. |
static java.lang.String |
getStringForNote(int noteValue)
|
static java.lang.String |
getStringForNote(int noteValue,
double decimalDuration)
|
byte |
getType()
Returns the note type - either First, Sequential, or Parallel. |
byte |
getValue()
Returns the numeric value of this note. |
boolean |
hasAccompanyingNotes()
Returns whether this Note will have other Notes (sequential or parallel) associated with it. |
boolean |
isEndOfTie()
Returns whether this note is tied to some past note. |
boolean |
isRest()
Returns whether this Note object actually represents a rest. |
boolean |
isStartOfTie()
Returns whether this note has a tie to some future note. |
void |
setAttackVelocty(byte velocity)
Sets the attack velocity for this note. |
void |
setDecayVelocty(byte velocity)
Sets the decay velocity for this note. |
void |
setDecimalDuration(double duration)
Sets the decimal fraction value for the duration. |
void |
setDuration(long duration)
Sets the duration of this note. |
void |
setEndOfTie(boolean endOfTie)
Indicates whether this note is tied to some past note. |
void |
setHasAccompanyingNotes(boolean accompanying)
Sets whether this Note will have other Notes (sequential or parallel) associated with it. |
void |
setRest(boolean rest)
Indicates whether this Note object actually represents a rest. |
void |
setStartOfTie(boolean startOfTie)
Indicates whether this note has a tie to some future note. |
void |
setType(byte type)
Sets the note type - either First, Sequential, or Parallel. |
void |
setValue(byte value)
Sets the numeric value of this note. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte FIRST
public static final byte SEQUENTIAL
public static final byte PARALLEL
public static final byte DEFAULT_VELOCITY
public static final java.lang.String[] NOTES
Constructor Detail |
---|
public Note()
public Note(byte value, long duration)
value
- the numeric value of the note. C5 is 60.duration
- the duration of the note.Method Detail |
---|
public void setRest(boolean rest)
rest
- indicates whether this note is restpublic boolean isRest()
public void setValue(byte value)
value
- the value of the notepublic byte getValue()
public void setDuration(long duration)
duration
- the duration of this notepublic long getDuration()
public void setDecimalDuration(double duration)
number
- the decimal fraction for the durationpublic double getDecimalDuration()
public void setStartOfTie(boolean startOfTie)
tied
- true if the note is tied, false if notpublic boolean isStartOfTie()
public void setEndOfTie(boolean endOfTie)
tied
- true if the note is tied, false if notpublic boolean isEndOfTie()
public void setAttackVelocty(byte velocity)
velocity
- the attack velocitypublic byte getAttackVelocity()
public void setDecayVelocty(byte velocity)
velocity
- the decay velocitypublic byte getDecayVelocity()
public void setHasAccompanyingNotes(boolean accompanying)
accompanying
- public boolean hasAccompanyingNotes()
public void setType(byte type)
type
- the note typepublic byte getType()
public java.lang.String getMusicString()
note
, or a bracketed number, [note-value],
and a duration, expressed as either a letter, duration
, or a slash followed by a numeric duration, /decimal-duration
If either the attack or decay velocity is set to a value besides the default, avelocity
and/or dvelocity
will be added to the string.
If this note is to be played in sequence or in parallel to another note, a +
or _
character will be added as appropriate.
- Specified by:
getMusicString
in interface JFugueElement
- Returns:
- the Music String for this element
public static java.lang.String getStringForNote(int noteValue, double decimalDuration)
public static java.lang.String getStringForNote(int noteValue)
public static java.lang.String getStringForDuration(double decimalDuration)
decimalDuration
- The decimal value of the duration to convert
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |