|
abc4j API Specification | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectabc.notation.NoteAbstract
abc.notation.Note
public class Note
This class defines a (single) Note : height, rhythm, part of tuplet, rest etc...
There can be some tricky representation of a duration for a note.
For instance :
Tuplets

The first tuplet describes 3 quarter notes in the time of 2. So in that case,
the representation of each note of tuplet as a Note object is :

| Field Summary | |
|---|---|
static byte |
a
The a note height type. |
static byte |
A
The A note height type : A440 |
static byte |
b
The b note height type. |
static byte |
B
The B note height type. |
static byte |
c
The c note height type. |
static byte |
C
The C note height type. |
static byte |
d
The d note height type. |
static byte |
D
The D note height type. |
static short |
DOTTED_EIGHTH
The DOTTED_EIGHTH length type. |
static short |
DOTTED_HALF
The DOTTED_HALF length type. |
static short |
DOTTED_QUARTER
The DOTTED_QUARTER length type. |
static short |
DOTTED_SIXTEENTH
The DOTTED_SIXTEENTH length type. |
static short |
DOTTED_SIXTY_FOURTH
The DOTTED_SIXTY_FOURTH length type. |
static short |
DOTTED_THIRTY_SECOND
The DOTTED_THIRTY_SECOND length type. |
static short |
DOTTED_WHOLE
The DOTTED_WHOLE length type. |
static byte |
e
The e note height type. |
static byte |
E
The E note height type. |
static short |
EIGHTH
The EIGHTH length type. |
static byte |
f
The f note height type. |
static byte |
F
The F note height type. |
static byte |
g
The g note height type. |
static byte |
G
The G note height type. |
static short |
HALF
The HALF length type. |
static short |
QUARTER
The QUARTER length type. |
static byte |
REST
The REST height type. |
static short |
SIXTEENTH
The SIXTEENTH length type. |
static short |
SIXTY_FOURTH
The SIXTY_FOURTH length type. |
static short |
THIRTY_SECOND
The THIRTY_SECOND length type. |
static short |
WHOLE
The WHOLE length type. |
| Fields inherited from class abc.notation.NoteAbstract |
|---|
DOWN, NONE, UP |
| Constructor Summary | |
|---|---|
Note(byte heightValue)
Creates an abc note with the specified height. |
|
Note(byte heightValue,
byte accidentalValue)
Creates an abc note with the specified heigth and accidental. |
|
Note(byte heightValue,
byte accidentalValue,
byte octaveTranspositionValue)
Creates an abc note with the specified heigth, accidental and octave transposition. |
|
| Method Summary | |
|---|---|
static byte |
convertToAccidentalType(java.lang.String accidental)
|
static short |
convertToNoteLengthStrict(int num,
int denom)
|
static byte |
convertToNoteType(java.lang.String note)
|
byte |
getAccidental()
Returns accidental for this note if any. |
short |
getDuration()
Returns the duration of this note. |
byte |
getHeight()
Returns this note height. |
byte |
getHeigth()
Deprecated. use getHeight() instead. Sorry for the typo.... |
static Note |
getHighestNote(Note[] notes)
|
static int |
getHighestNoteIndex(Note[] notes)
|
static Note |
getLowestNote(Note[] notes)
|
byte |
getOctaveTransposition()
Returns the octave transposition for this note. |
static byte |
getOctaveTransposition(byte height)
Returns the octave transposition for the specified height relative to its strict height. |
short |
getStrictDuration()
Returns the strict duration of this note. |
byte |
getStrictHeight()
Returns this note absolute height. |
static byte |
getStrictHeight(byte height)
Returns this note absolute height. |
TieDefinition |
getTieDefinition()
|
boolean |
hasAccidental()
|
boolean |
isBeginningTie()
Returns true if this note is beginning a tie. |
boolean |
isEndingTie()
Returns true if this note is ending a tie. |
boolean |
isHigherThan(Note aNote)
Returns true if the given note is strictly higher than this one. |
boolean |
isLowerThan(Note aNote)
|
boolean |
isRest()
A convenient method that returns true if this note is a rest. |
static boolean |
isStrictDuration(short noteDuration)
Returns true if the duration of the note is one of the following : Note.WHOLE, Note.HALF, Note.QUARTER, Note.EIGHTH, Note.SIXTEENTH, Note.THIRTY_SECOND, Note.SIXTY_FOURTH. |
boolean |
isTied()
Returns true if this note is tied. |
void |
setAccidental(byte accidentalValue)
Sets the accidental for this note. |
void |
setDotted(byte dotsNb)
Sets the number of dots for this note. |
void |
setDuration(short duration)
Sets the length of this note. |
void |
setHeight(byte heightValue)
Sets the height of this note. |
void |
setHeigth(byte heigthValue)
Deprecated. use setHeight(byte heigthValue) instead. sorry for the typo... |
void |
setLength(short length)
Deprecated. use setDuration(short duration) instead. |
void |
setOctaveTransposition(byte octaveTranspositionValue)
Sets the octave transposition for this note. |
void |
setStrictDuration(short strictDuration)
Sets the strict duration of this note. |
void |
setTieDefinition(TieDefinition tieDef)
Sets the tie definition for this note. |
byte |
toRootOctaveHeigth()
Deprecated. use getStrictHeight() instead |
java.lang.String |
toString()
Returns a String representation of this Object. |
| Methods inherited from class abc.notation.NoteAbstract |
|---|
countDots, getBow, getChordName, getDotted, getGracingNotes, getGracingNotesLength, getSlurDefinition, getTuplet, hasGeneralGracing, hasGracingNotes, hasStaccato, isBeginingSlur, isEndingSlur, isPartOfSlur, isPartOfTuplet, setBow, setChordName, setGeneralGracing, setGracingNotes, setPartOfSlur, setSlurDefinition, setStaccato |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte C
public static final byte D
public static final byte E
public static final byte F
public static final byte G
public static final byte A
public static final byte B
public static final byte c
public static final byte d
public static final byte e
public static final byte f
public static final byte g
public static final byte a
public static final byte b
public static final byte REST
public static final short DOTTED_WHOLE
public static final short WHOLE
public static final short DOTTED_HALF
public static final short HALF
public static final short DOTTED_QUARTER
public static final short QUARTER
public static final short DOTTED_EIGHTH
public static final short EIGHTH
public static final short DOTTED_SIXTEENTH
public static final short SIXTEENTH
public static final short DOTTED_THIRTY_SECOND
public static final short THIRTY_SECOND
public static final short DOTTED_SIXTY_FOURTH
public static final short SIXTY_FOURTH
| Constructor Detail |
|---|
public Note(byte heightValue)
heightValue - The heigth of this note as a byte that respect the scale defined by
constants such as C D E F G A B c d e ..... The heigth is REST if
this note is a rest.setHeight(byte)
public Note(byte heightValue,
byte accidentalValue)
heightValue - The heigth of this note as a byte that respect the scale defined by
constants such as C D E F G A B c d e ..... The heigth is REST if
this note is a rest.accidentalValue - Accidental for this note. Possible values are
AccidentalType.NATURAL, AccidentalType.SHARP (#),
AccidentalType.FLAT (b) or AccidentalType.NONE.setAccidental(byte),
setHeight(byte)
public Note(byte heightValue,
byte accidentalValue,
byte octaveTranspositionValue)
heightValue - The heigth of this note as a byte that respect the scale defined by
constants such as C D E F G A B c d e ..... The heigth is REST if
this note is a rest.accidentalValue - Accidental for this note. Possible values are
AccidentalType.NATURAL, AccidentalType.SHARP (#),
AccidentalType.FLAT (b) or AccidentalType.NONE.octaveTranspositionValue - The octave transposition for this note :
1, 2 or 3 means "1, 2 or 3 octave(s) higher than the reference octave" and
-1, -2 or -3 means "1, 2 or 3 octave(s) less than the reference octave".setAccidental(byte),
setOctaveTransposition(byte),
setHeight(byte)| Method Detail |
|---|
public void setHeigth(byte heigthValue)
heigthValue - The height of this note. The height is REST if
this note is a rest.setHeight(byte)
public void setHeight(byte heightValue)
throws java.lang.IllegalArgumentException
setAccidental(byte) method.
heightValue - The height of this note as a byte that respect the scale defined by
constants such as C D E F G A B c d e ..... The height is REST if
this note is a rest.
java.lang.IllegalArgumentExceptiongetHeight(),
setAccidental(byte)public byte getHeigth()
getHeight()public byte getHeight()
getAccidental().
getStrictHeight(),
setHeight(byte)public boolean isHigherThan(Note aNote)
aNote - A note instance.
isLowerThan(Note)public boolean isLowerThan(Note aNote)
public byte getStrictHeight()
getHeight(),
setHeight(byte)public static byte getStrictHeight(byte height)
height - A height of a note as a byte that respect the scale defined by
constants such as C D E F G A B c d e ....
getHeight()public static byte getOctaveTransposition(byte height)
height - A height as a byte that respect the scale defined by
constants such as C D E F G A B c d e ....
public byte toRootOctaveHeigth()
getStrictHeight()public void setOctaveTransposition(byte octaveTranspositionValue)
octaveTranspositionValue - The octave transposition for this note :
1, 2 or 3 means "1, 2 or 3 octave(s) higher than the reference octave" and
-1, -2 or -3 means "1, 2 or 3 octave(s) less than the reference octave".public byte getOctaveTransposition()
setOctaveTransposition(byte)public void setLength(short length)
length - The length of this note as a value adjusted to
the scale of constants such as Note.WHOLE, Note.HALF etc etc ...setDuration(short)public void setDuration(short duration)
duration - The length of this note as a value adjusted to
the scale of constants such as Note.WHOLE, Note.HALF etc etc ...getDuration()
public void setStrictDuration(short strictDuration)
throws java.lang.IllegalArgumentException
strictDuration - This note strict duration. Possible values are ONLY
Note.WHOLE, Note.HALF,
Note.QUARTER, Note.EIGHTH, Note.SIXTEENTH,
Note.THIRTY_SECOND, Note.SIXTY_FOURTH.
java.lang.IllegalArgumentException - Thrown if the given duration does not
match the excepted ones.public short getStrictDuration()
getDuration()public short getDuration()
setLength(short),
getStrictDuration()public void setAccidental(byte accidentalValue)
accidentalValue - Accidental for this note. Possible values are
AccidentalType.NATURAL, AccidentalType.SHARP (#),
AccidentalType.FLAT (b) or AccidentalType.NONE.public byte getAccidental()
setAccidental(byte)public boolean hasAccidental()
public void setTieDefinition(TieDefinition tieDef)
tieDef - The definition of the tie if this note is tied. NULL if the
note should not be tied.isTied()public TieDefinition getTieDefinition()
public boolean isBeginningTie()
public boolean isEndingTie()
public boolean isTied()
setTieDefinition(TieDefinition)public boolean isRest()
getHeight()
or getStrictHeight() is equals to Note.REST.
public void setDotted(byte dotsNb)
setDotted in class NoteAbstractdotsNb - The number of dots for this note.NoteAbstract.countDots()public static byte convertToNoteType(java.lang.String note)
public static short convertToNoteLengthStrict(int num,
int denom)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static byte convertToAccidentalType(java.lang.String accidental)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic java.lang.String toString()
NoteAbstract
toString in class NoteAbstractpublic static boolean isStrictDuration(short noteDuration)
noteDuration - The note duration to be checked
public static Note getHighestNote(Note[] notes)
public static int getHighestNoteIndex(Note[] notes)
public static Note getLowestNote(Note[] notes)
|
abc4j API Specification | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||