abc.notation
Class Note

java.lang.Object
  extended byabc.notation.NoteAbstract
      extended byabc.notation.Note
All Implemented Interfaces:
ScoreElementInterface
Direct Known Subclasses:
PositionableNote

public class Note
extends NoteAbstract

This class defines a (single) Note : heigth, rhythm, part of tuplet, rest etc...


Field Summary
static byte a
          The a note heigth type.
static byte A
          The A note heigth type : A404
static byte b
          The b note heigth type.
static byte B
          The B note heigth type.
static byte c
          The c note heigth type.
static byte C
          The C note heigth type.
static byte d
          The d note heigth type.
static byte D
          The D note heigth 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 heigth type.
static byte E
          The E note heigth type.
static short EIGHTH
          The EIGHTH length type.
static byte f
          The f note heigth type.
static byte F
          The F note heigth type.
static byte g
          The g note heigth type.
static byte G
          The G note heigth type.
static short HALF
          The HALF length type.
static short QUARTER
          The QUARTER length type.
static byte REST
          The REST heigth 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 heigthValue, byte accidentalValue)
          Creates an abc note with the specified heigth and accidental.
Note(byte heigthValue, 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 relative length of this note.
 byte getHeigth()
          Returns this note absolute height.
 byte getOctaveTransposition()
          Returns the octave transposition for this note.
 boolean isRest()
          Returns true if this note is a rest
 boolean isTied()
          Returns true if this note is tied.
 void setAccidental(byte accidentalValue)
          Sets the accidental for this note.
 void setHeigth(byte heigthValue)
          Sets the heigth of this note.
 void setIsTied(boolean isTied)
          Sets if this note is tied, wheter or not.
 void setLength(short length)
           
 void setOctaveTransposition(byte octaveTranspositionValue)
          Sets the octave transposition for this note.
 byte toRootOctaveHeigth()
          Returns the heigth of this note on the first octave.
 java.lang.String toString()
          Returns a String representation of this Object.
 
Methods inherited from class abc.notation.NoteAbstract
getBow, getChordName, getDotted, getGracingNotes, getGracingNotesLength, getTuplet, hasGeneralGracing, hasGracingNotes, hasStaccato, isPartOfSlur, isPartOfTuplet, setBow, setChordName, setDotted, setGeneralGracing, setGracingNotes, setPartOfSlur, setStaccato
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

C

public static final byte C
The C note heigth type.

See Also:
Constant Field Values

D

public static final byte D
The D note heigth type.

See Also:
Constant Field Values

E

public static final byte E
The E note heigth type.

See Also:
Constant Field Values

F

public static final byte F
The F note heigth type.

See Also:
Constant Field Values

G

public static final byte G
The G note heigth type.

See Also:
Constant Field Values

A

public static final byte A
The A note heigth type : A404

See Also:
Constant Field Values

B

public static final byte B
The B note heigth type.

See Also:
Constant Field Values

c

public static final byte c
The c note heigth type.

See Also:
Constant Field Values

d

public static final byte d
The d note heigth type.

See Also:
Constant Field Values

e

public static final byte e
The e note heigth type.

See Also:
Constant Field Values

f

public static final byte f
The f note heigth type.

See Also:
Constant Field Values

g

public static final byte g
The g note heigth type.

See Also:
Constant Field Values

a

public static final byte a
The a note heigth type.

See Also:
Constant Field Values

b

public static final byte b
The b note heigth type.

See Also:
Constant Field Values

REST

public static final byte REST
The REST heigth type.

See Also:
Constant Field Values

DOTTED_WHOLE

public static final short DOTTED_WHOLE
The DOTTED_WHOLE length type.

See Also:
Constant Field Values

WHOLE

public static final short WHOLE
The WHOLE length type.

See Also:
Constant Field Values

DOTTED_HALF

public static final short DOTTED_HALF
The DOTTED_HALF length type.

See Also:
Constant Field Values

HALF

public static final short HALF
The HALF length type.

See Also:
Constant Field Values

DOTTED_QUARTER

public static final short DOTTED_QUARTER
The DOTTED_QUARTER length type.

See Also:
Constant Field Values

QUARTER

public static final short QUARTER
The QUARTER length type.

See Also:
Constant Field Values

DOTTED_EIGHTH

public static final short DOTTED_EIGHTH
The DOTTED_EIGHTH length type.

See Also:
Constant Field Values

EIGHTH

public static final short EIGHTH
The EIGHTH length type.

See Also:
Constant Field Values

DOTTED_SIXTEENTH

public static final short DOTTED_SIXTEENTH
The DOTTED_SIXTEENTH length type.

See Also:
Constant Field Values

SIXTEENTH

public static final short SIXTEENTH
The SIXTEENTH length type.

See Also:
Constant Field Values

DOTTED_THIRTY_SECOND

public static final short DOTTED_THIRTY_SECOND
The DOTTED_THIRTY_SECOND length type.

See Also:
Constant Field Values

THIRTY_SECOND

public static final short THIRTY_SECOND
The THIRTY_SECOND length type.

See Also:
Constant Field Values

DOTTED_SIXTY_FOURTH

public static final short DOTTED_SIXTY_FOURTH
The DOTTED_SIXTY_FOURTH length type.

See Also:
Constant Field Values

SIXTY_FOURTH

public static final short SIXTY_FOURTH
The SIXTY_FOURTH length type.

See Also:
Constant Field Values
Constructor Detail

Note

public Note(byte heigthValue,
            byte accidentalValue)
Creates an abc note with the specified heigth and accidental.

Parameters:
heigthValue - The heigth of the note.
accidentalValue - The accidental of the note.

Note

public Note(byte heigthValue,
            byte accidentalValue,
            byte octaveTranspositionValue)
Creates an abc note with the specified heigth, accidental and octave transposition.

Parameters:
heigthValue -
accidentalValue -
Method Detail

setHeigth

public void setHeigth(byte heigthValue)
Sets the heigth of this note.

Parameters:
heigthValue - The heigth of this note. The heigth is REST if this note is a rest.
See Also:
setHeigth(byte)

getHeigth

public byte getHeigth()
Returns this note absolute height. This height doesn't take in account octave transposition.

Returns:
This note height. REST is returned if this note is a rest. Possible other values are C, D, E, F, G, A, B, c, d, e, f, g, a or b.

toRootOctaveHeigth

public byte toRootOctaveHeigth()
Returns the heigth of this note on the first octave.

Returns:
the heigth of this note on the first octave. Possible values are C, D, E, F, G, A(404) or B.

setOctaveTransposition

public void setOctaveTransposition(byte octaveTranspositionValue)
Sets the octave transposition for this note.

Parameters:
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".

getOctaveTransposition

public byte getOctaveTransposition()
Returns the octave transposition for this note.

Returns:
The octave transposition for this note. Default is 0.

setLength

public void setLength(short length)

getDuration

public short getDuration()
Returns the relative length of this note.

Returns:
The relative length of this note. The relative length can be converted into absolute length (the real length of the note) by using the default note length value defines in the score this note belongs to.

setAccidental

public void setAccidental(byte accidentalValue)
Sets the accidental for this note.

Parameters:
accidentalValue - Accidental for this note. Possible values are NATURAL, SHARP (#) or FLAT (b).

getAccidental

public byte getAccidental()
Returns accidental for this note if any.

Returns:
Accidental for this note if any. Possible values are NATURAL, FLAT or SHARP.
See Also:
setAccidental(byte)

setIsTied

public void setIsTied(boolean isTied)
Sets if this note is tied, wheter or not.

Parameters:
isTied - true if this note is tied, false otherwise.

isTied

public boolean isTied()
Returns true if this note is tied.

Returns:
true if this note is tied, false otherwise.

isRest

public boolean isRest()
Returns true if this note is a rest

Returns:
true if this note is a rest, false otherwise.

convertToNoteType

public static byte convertToNoteType(java.lang.String note)

convertToNoteLengthStrict

public static short convertToNoteLengthStrict(int num,
                                              int denom)
                                       throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

convertToAccidentalType

public static byte convertToAccidentalType(java.lang.String accidental)
                                    throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

toString

public java.lang.String toString()
Description copied from class: NoteAbstract
Returns a String representation of this Object.

Overrides:
toString in class NoteAbstract
Returns:
a String representation of this Object.