com.softsynth.jmsl.score
Class Note

java.lang.Object
  extended by com.softsynth.jmsl.score.Note
All Implemented Interfaces:
DimensionNameSpaceEditable, InstrumentPlayable, XMLWritable, java.lang.Cloneable

public class Note
extends java.lang.Object
implements InstrumentPlayable, java.lang.Cloneable, XMLWritable, DimensionNameSpaceEditable

Note
A Note is a Playable object with dur/note/amp/hold info as well as graphic info.
JMSL Notation Project

Author:
Nick Didkovsky , copyright 2000 Nick Didkovsky

Field Summary
static int ACC_DOUBLE_FLAT
           
static int ACC_DOUBLE_SHARP
           
static int ACC_FLAT
           
static int ACC_NATURAL
           
static int ACC_NO_PREFERENCE
          only used by EditManager, not by Note.
static int ACC_NONE
           
static int ACC_PREFER_FLAT
           
static int ACC_PREFER_SHARP
           
static int ACC_QUARTERTONE_FLAT
           
static int ACC_QUARTERTONE_SHARP
           
static int ACC_SHARP
           
static int ACC_THREEQUARTERTONE_FLAT
           
static int ACC_THREEQUARTERTONE_SHARP
           
static java.lang.String copyright
           
static java.lang.String[] coreDurationNames
           
static double[] coreDurations
           
static boolean DBUG
           
static int DYNAMIC_F
           
static int DYNAMIC_FF
           
static int DYNAMIC_FFF
           
static int DYNAMIC_MF
           
static int DYNAMIC_MP
           
static int DYNAMIC_NONE
           
static int DYNAMIC_P
           
static int DYNAMIC_PP
           
static int DYNAMIC_PPP
           
static int EIGHTH
           
static int HALF
           
static int MARK_ACCENT
           
static int MARK_ACCENT_STACCATO
           
static int MARK_ACCENT_TENUTO
           
static int MARK_FERMATA
           
static int MARK_HARMONIC
           
static int MARK_INVERTED_MORDANT
           
static int MARK_MORDANT
           
static int MARK_NONE
           
static int MARK_STACCATO
           
static int MARK_TENUTO
           
static int MARK_TRILL
           
static int MARK_TRILL_FLAT
           
static int MARK_TRILL_NATURAL
           
static int MARK_TRILL_SHARP
           
static int MARK_WEDGE
           
static int MARK_WEDGE_STACCATO
           
static int NOTEHEAD_BLACK
           
static int NOTEHEAD_BLACK_DIAMOND
           
static int NOTEHEAD_BLACK_INVERTEDTRIANGLE
           
static int NOTEHEAD_BLACK_TRIANGLE
           
static int NOTEHEAD_BREVE
          not implemented
static int NOTEHEAD_RESERVED_1
          not implemented
static int NOTEHEAD_RESERVED_2
          not implemented
static int NOTEHEAD_SLASH
           
static int NOTEHEAD_WHITE
           
static int NOTEHEAD_WHITE_DIAMOND
           
static int NOTEHEAD_WHITE_INVERTEDTRIANGLE
           
static int NOTEHEAD_WHITE_TRIANGLE
           
static int NOTEHEAD_X
           
static int NOTEHEAD_X_DIAMOND
           
static int NOTEHEAD_X_OVAL
           
static java.lang.String[] noteheadNames
           
static int ONEHUNDREDTWENTYEIGHTH
           
static int QUARTER
           
static int SIXTEENTH
           
static int SIXTYFOURTH
           
static int STEM_DOWN
           
static int STEM_NONE
           
static int STEM_UP
           
static int THIRTYSECOND
           
static int TWOHUNDREDFIFTYSIXTH
           
static int WHOLE
           
 
Constructor Summary
Note(int coreDur, int tuplet, int dots, int accInfo)
           
Note(Track track, double dur, double pitch, double vel, double hold)
          Constructor specifies playable info.
 
Method Summary
static java.lang.String accToString(int acc)
           
 Note addInterval(double pitch)
          Add an interval to this Note.
 Note addInterval(Note newNote)
          add newNote as interval to this Note.
 void clearIntervals()
           
static Note cloneNote(Note n)
          Make an exact copy of a Note.
static void copyProperties(Note fromNote, Note toNote)
          Copy properties from one Note to another.
static java.lang.String dynamicToString(int dynamic)
           
 boolean endOf8va()
           
 boolean endOf8vb()
           
 boolean endOfCresc()
           
 boolean endOfDecresc()
           
static boolean firstNoteOfLine(Note note)
           
 boolean get8vaIn()
           
 boolean get8vaOut()
           
 boolean get8vbIn()
           
 boolean get8vbOut()
           
 int getAcc()
           
 boolean getAccHidden()
           
 int getAccPref()
          Indicates Note's spelling preferences if it requires an accidental
 boolean getAltEnharmonicSpelling()
          Flag determines if note uses alternate enharmonic spelling (ex E#, F##, Cb, Fbb, etc).
 boolean getBeamedOut()
           
 int getCoreDuration()
          Synonynmous with getNoteDur()
 boolean getCrescIn()
           
 boolean getCrescOut()
           
 double[] getData()
           
 double getData(int dimension)
           
 double[] getDataCopy()
          Convenience method, shorthand for getData() and System.arraycopy()
 boolean getDecrescIn()
           
 boolean getDecrescOut()
           
 DimensionNameSpace getDimensionNameSpace()
           
 double[] getDoubleArray()
          synonym with getData()
 java.awt.Point getDrawingAnchor()
          anchor is the horizontal note location
 double getDurationData()
           
 int getDynamic()
           
 Note getHandle()
           
static Note getHighest(Note n)
          Assuming this Note is a chord, find the Note with the highest pitch.
 double getHoldData()
           
static int getIndexOfCoreDuration(double duration)
          input: duration like 0.25
 java.util.Vector getIntervals()
           
 int getLevel()
           
static Note getLowest(Note n)
          Assuming this Note is a chord, find the Note with the lowest pitch.
 int getMark()
           
 int getMeasureIndex()
           
 int getNoteDur()
           
 double getNoteDurationAsPerformanceTime()
           
static double getNoteDurationAsPerformanceTime(int durConst)
           
 int getNoteHeadType()
           
 int getNoteIndex()
           
 int getNumDots()
           
 int getNumTails()
           
 boolean getOverflow()
           
 double[] getPerformanceData()
          translate internal performance data based on expressive properties.
 double[] getPerformanceDataCopy()
          translate internal performance data based on expressive properties.
 double getPitchData()
           
static Note getRoot(Note n)
          Assuming this Note is a chord, find the Note with the lowest pitch.
 Score getScore()
           
 boolean getSelected()
           
 boolean getSlurredIn()
           
 boolean getSlurredOut()
           
static Note[] getSortedChord(Note n)
          Get an array containing this Note's intervals and handle in sorted order
 int getStaffIndex()
           
 int getStemInfo()
          Get stem info 0=no stem, 1=stem up, 2= stem down
 java.lang.String getText()
           
 int getTextOffsetX()
          horizontal text displacement
 int getTextOffsetY()
          vertical text displacement
 boolean getTiedIn()
           
 boolean getTiedOut()
           
 Track getTrack()
           
 int getTuplet()
           
 double getVelData()
           
 boolean isBeamable()
           
 boolean isChord()
           
 boolean isInterval()
           
 boolean isMonoNote()
           
 boolean isRest()
           
static boolean lastNoteOfLine(Note note)
           
static void main(java.lang.String[] args)
           
static java.lang.String markToString(int mark)
           
 Note nextNote()
           
static boolean performExpressionMarks()
           
 double play(double playTime, Composable parent, Instrument ins)
          play() is called by MusicList.
 Note prevNote()
           
 void removeInterval(Note n)
           
 void render(java.awt.Graphics g, double zoom)
           
 void replaceDrawingAnchor(java.awt.Point p)
          anchor is the horizontal note location
static void resortChord(Note n)
          make root == handle == lowest pitched note, sort the vector of intervals low to high
 void set8vaOut(boolean flag)
          Set 8va out flag on Note.
 void set8vbOut(boolean flag)
          Set 8vb out flag on Note.
 void setAcc(int acc)
          Set accidental info 0=none, 1=sharp, 2=flat, 3=natural
 void setAccHidden(boolean flag)
          Set accidental hidden flag 0,1
 void setAccPref(int pref)
          Set preferred accidental spelling: Note.ACC_PREFER_SHARP or Note.ACC_PREFER_FLAT.
 void setAltEnharmonicSpelling(boolean flag)
          Set flag determines if note uses alternate enharmonic spelling (ex E#, F##, Cb, Fbb, etc).
 void setBeamedOut(boolean f)
          set the beamed out flag for this note and all intervals and handle
 void setBeamedOutNoLoop(boolean f)
           
 void setCrescOut(boolean flag)
          Set crescendo out flag on Note.
 void setData(double[] data)
           
 void setData(double dur, double midinote, double vel, double hold)
          set four dimensional double[] data
 void setData(int dimension, double value)
          Set the value of one element of the double[] array held by this Note.
 void setDecrescOut(boolean flag)
          Set decrescendo out flag on Note.
 void setDimensionNameSpace(DimensionNameSpace d)
           
 void setDoubleArray(double[] dar)
          Hand Note an entirely new array of data.
 void setDrawingAnchor(java.awt.Point p)
          anchor is the horizontal note location
 void setDurationData(double dur)
          set performable duration, where 1.0=quarter note
 void setDynamic(int dynamic)
          set dynamic marking for this note
 void setHandle(Note p)
           
 void setHoldData(double hold)
          set performable duration of hold, where 1.0 = quarter note
static void setIntervalsToTrackOfHandle(Note note)
           
 void setLevel(int l)
          set the vertical placement of note on staff
 void setMark(int mark)
          Set mark where int is one of the following:
 void setMeasureIndex(int m)
          Use with caution! Only retrievable with getMeasureIndex() if this note has no track or staff
 void setNoteDur(int d)
          Set note duration to constants 0..8 standing for WHOLE, HALF, QUARTER,...
 void setNoteHeadType(int noteheadType)
          Set to Note.NOTEHEAD_BLACK or Note.NOTEHEAD_WHITE, or new constants for X, diamond, etc
 void setNumDots(int n)
          Set number of dots following this note, 0, 1, or 2
 void setNumTails(int n)
          Deprecated. does nothing. getNumTails() is now calculated from core duration
 void setOverflow(boolean f)
          true if this note is at the end of a track whose total durations exceeds the measure's timesig's duration.
static void setPerformExpressionMarks(boolean flag)
          if true, staccato, accent staccato, and tenuto marks will affect hold time on a Note
 void setPitchData(double pitch)
          set performable pitch 1..127.
 void setSelected(boolean flag)
          Set selected flag on Note (if user drew a rectangle that included this Note, for ex.)
 void setSlurredOut(boolean flag)
          Set slur out flag on Note
 void setStaffIndex(int s)
          Use with caution! Only retrievable with getStaffIndex() if this note has no track or staff
 void setStemInfo(int stem)
          Set stem info 0=no stem, 1=stem up, 2= stem down
 void setText(java.lang.String s)
          Set text to display by this note
 void setTextOffsetX(int xoffset)
          horizontal text displacement
 void setTextOffsetY(int yoffset)
          vertical text displacement
 void setTiedOut(boolean flag)
          Set tied out flag on Note
 void setTrack(Track track)
           
 void setTuplet(int n)
          Set the tuplet value (3 for triplet, 5 for quintuplet, etc, up to 31
 void setVelData(double vel)
          set performable amplitude data (0..1)
 boolean startOf8va()
           
 boolean startOf8vb()
           
 boolean startOfCresc()
           
 boolean startOfDecresc()
           
 java.lang.String toString()
           
static double tupletDur(int n, double dur)
          Calculate duration of n-tuplet, given n and its non-tuplet duration.
 void writeXML(java.io.PrintWriter out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DBUG

public static boolean DBUG

MARK_NONE

public static final int MARK_NONE
See Also:
Constant Field Values

MARK_ACCENT

public static final int MARK_ACCENT
See Also:
Constant Field Values

MARK_STACCATO

public static final int MARK_STACCATO
See Also:
Constant Field Values

MARK_TENUTO

public static final int MARK_TENUTO
See Also:
Constant Field Values

MARK_WEDGE

public static final int MARK_WEDGE
See Also:
Constant Field Values

MARK_ACCENT_STACCATO

public static final int MARK_ACCENT_STACCATO
See Also:
Constant Field Values

MARK_ACCENT_TENUTO

public static final int MARK_ACCENT_TENUTO
See Also:
Constant Field Values

MARK_WEDGE_STACCATO

public static final int MARK_WEDGE_STACCATO
See Also:
Constant Field Values

MARK_FERMATA

public static final int MARK_FERMATA
See Also:
Constant Field Values

MARK_HARMONIC

public static final int MARK_HARMONIC
See Also:
Constant Field Values

MARK_TRILL

public static final int MARK_TRILL
See Also:
Constant Field Values

MARK_TRILL_FLAT

public static final int MARK_TRILL_FLAT
See Also:
Constant Field Values

MARK_TRILL_SHARP

public static final int MARK_TRILL_SHARP
See Also:
Constant Field Values

MARK_TRILL_NATURAL

public static final int MARK_TRILL_NATURAL
See Also:
Constant Field Values

MARK_MORDANT

public static final int MARK_MORDANT
See Also:
Constant Field Values

MARK_INVERTED_MORDANT

public static final int MARK_INVERTED_MORDANT
See Also:
Constant Field Values

STEM_NONE

public static final int STEM_NONE
See Also:
Constant Field Values

STEM_UP

public static final int STEM_UP
See Also:
Constant Field Values

STEM_DOWN

public static final int STEM_DOWN
See Also:
Constant Field Values

ACC_NONE

public static final int ACC_NONE
See Also:
Constant Field Values

ACC_SHARP

public static final int ACC_SHARP
See Also:
Constant Field Values

ACC_FLAT

public static final int ACC_FLAT
See Also:
Constant Field Values

ACC_NATURAL

public static final int ACC_NATURAL
See Also:
Constant Field Values

ACC_DOUBLE_FLAT

public static final int ACC_DOUBLE_FLAT
See Also:
Constant Field Values

ACC_DOUBLE_SHARP

public static final int ACC_DOUBLE_SHARP
See Also:
Constant Field Values

ACC_QUARTERTONE_FLAT

public static final int ACC_QUARTERTONE_FLAT
See Also:
Constant Field Values

ACC_THREEQUARTERTONE_FLAT

public static final int ACC_THREEQUARTERTONE_FLAT
See Also:
Constant Field Values

ACC_QUARTERTONE_SHARP

public static final int ACC_QUARTERTONE_SHARP
See Also:
Constant Field Values

ACC_THREEQUARTERTONE_SHARP

public static final int ACC_THREEQUARTERTONE_SHARP
See Also:
Constant Field Values

ACC_PREFER_SHARP

public static final int ACC_PREFER_SHARP
See Also:
Constant Field Values

ACC_PREFER_FLAT

public static final int ACC_PREFER_FLAT
See Also:
Constant Field Values

ACC_NO_PREFERENCE

public static final int ACC_NO_PREFERENCE
only used by EditManager, not by Note. If EditManager pref is ACC_NO_PREFERENCE, then accidental preference of newly inserted note will be determined by key signature

See Also:
Constant Field Values

WHOLE

public static final int WHOLE
See Also:
Constant Field Values

HALF

public static final int HALF
See Also:
Constant Field Values

QUARTER

public static final int QUARTER
See Also:
Constant Field Values

EIGHTH

public static final int EIGHTH
See Also:
Constant Field Values

SIXTEENTH

public static final int SIXTEENTH
See Also:
Constant Field Values

THIRTYSECOND

public static final int THIRTYSECOND
See Also:
Constant Field Values

SIXTYFOURTH

public static final int SIXTYFOURTH
See Also:
Constant Field Values

ONEHUNDREDTWENTYEIGHTH

public static final int ONEHUNDREDTWENTYEIGHTH
See Also:
Constant Field Values

TWOHUNDREDFIFTYSIXTH

public static final int TWOHUNDREDFIFTYSIXTH
See Also:
Constant Field Values

coreDurations

public static final double[] coreDurations

coreDurationNames

public static final java.lang.String[] coreDurationNames

NOTEHEAD_BLACK

public static final int NOTEHEAD_BLACK
See Also:
Constant Field Values

NOTEHEAD_WHITE

public static final int NOTEHEAD_WHITE
See Also:
Constant Field Values

NOTEHEAD_X

public static final int NOTEHEAD_X
See Also:
Constant Field Values

NOTEHEAD_X_OVAL

public static final int NOTEHEAD_X_OVAL
See Also:
Constant Field Values

NOTEHEAD_X_DIAMOND

public static final int NOTEHEAD_X_DIAMOND
See Also:
Constant Field Values

NOTEHEAD_WHITE_DIAMOND

public static final int NOTEHEAD_WHITE_DIAMOND
See Also:
Constant Field Values

NOTEHEAD_BLACK_DIAMOND

public static final int NOTEHEAD_BLACK_DIAMOND
See Also:
Constant Field Values

NOTEHEAD_WHITE_TRIANGLE

public static final int NOTEHEAD_WHITE_TRIANGLE
See Also:
Constant Field Values

NOTEHEAD_BLACK_TRIANGLE

public static final int NOTEHEAD_BLACK_TRIANGLE
See Also:
Constant Field Values

NOTEHEAD_WHITE_INVERTEDTRIANGLE

public static final int NOTEHEAD_WHITE_INVERTEDTRIANGLE
See Also:
Constant Field Values

NOTEHEAD_BLACK_INVERTEDTRIANGLE

public static final int NOTEHEAD_BLACK_INVERTEDTRIANGLE
See Also:
Constant Field Values

NOTEHEAD_BREVE

public static final int NOTEHEAD_BREVE
not implemented

See Also:
Constant Field Values

NOTEHEAD_SLASH

public static final int NOTEHEAD_SLASH
See Also:
Constant Field Values

NOTEHEAD_RESERVED_1

public static final int NOTEHEAD_RESERVED_1
not implemented

See Also:
Constant Field Values

NOTEHEAD_RESERVED_2

public static final int NOTEHEAD_RESERVED_2
not implemented

See Also:
Constant Field Values

noteheadNames

public static final java.lang.String[] noteheadNames

DYNAMIC_NONE

public static final int DYNAMIC_NONE
See Also:
Constant Field Values

DYNAMIC_PPP

public static final int DYNAMIC_PPP
See Also:
Constant Field Values

DYNAMIC_PP

public static final int DYNAMIC_PP
See Also:
Constant Field Values

DYNAMIC_P

public static final int DYNAMIC_P
See Also:
Constant Field Values

DYNAMIC_MP

public static final int DYNAMIC_MP
See Also:
Constant Field Values

DYNAMIC_MF

public static final int DYNAMIC_MF
See Also:
Constant Field Values

DYNAMIC_F

public static final int DYNAMIC_F
See Also:
Constant Field Values

DYNAMIC_FF

public static final int DYNAMIC_FF
See Also:
Constant Field Values

DYNAMIC_FFF

public static final int DYNAMIC_FFF
See Also:
Constant Field Values

copyright

public static final java.lang.String copyright
See Also:
Constant Field Values
Constructor Detail

Note

public Note(Track track,
            double dur,
            double pitch,
            double vel,
            double hold)
Constructor specifies playable info. Later will calculate this from notated attributes


Note

public Note(int coreDur,
            int tuplet,
            int dots,
            int accInfo)
Method Detail

cloneNote

public static Note cloneNote(Note n)
Make an exact copy of a Note. Calls clone and then copyProperties()


copyProperties

public static void copyProperties(Note fromNote,
                                  Note toNote)
Copy properties from one Note to another.
Properties include: getData() array, drawing anchor, track, intervals, dimension name space, dynamic, slur, beam, (de)cresc,8ba/b, core duration

Parameters:
fromNote -
toNote -

setIntervalsToTrackOfHandle

public static void setIntervalsToTrackOfHandle(Note note)

isChord

public boolean isChord()
Returns:
true if intervals Vector is non-empty, false otherwise

isInterval

public boolean isInterval()
Returns:
true if this Note has a handle (handle is a handle to chord)

isMonoNote

public boolean isMonoNote()
Returns:
true if this is monophonic note, ie, not the handle of a chord and not an interval in a chord

addInterval

public Note addInterval(double pitch)
Add an interval to this Note. Makes "this" a chord. "This" may not necessarily be the lowest pitch of the chord as it's implemented now, but provides the anchor, and so is called the root.

Returns:
Note of new interval or null. Reasons for null include trying to add an interval to a rest, or if interval with pitch already exists

addInterval

public Note addInterval(Note newNote)
add newNote as interval to this Note.

Returns:
newNote if successful, else null . Reasons for null include trying to add an interval to a rest, or if interval with same pitch as newNote already exists

removeInterval

public void removeInterval(Note n)

clearIntervals

public void clearIntervals()

setHandle

public void setHandle(Note p)

getHandle

public Note getHandle()

getIntervals

public java.util.Vector getIntervals()

getNoteIndex

public int getNoteIndex()
Returns:
the position index of this Note in its Track

nextNote

public Note nextNote()
Returns:
the next Note in this Track, or first Note of next Track, or null if Track empty

prevNote

public Note prevNote()
Returns:
the next Note in this Track, or first Note of next Track, or null if Track empty

isRest

public boolean isRest()
Returns:
true if note is a rest (same as getPitchData() == 0.0)

isBeamable

public boolean isBeamable()
Returns:
true of this note is capable of carrying a beam (false if a rest)

getDurationData

public double getDurationData()
Returns:
duration where qtr = 1.0, eighth = 0.5, 16th = 0.25, etc

getPitchData

public double getPitchData()
Returns:
performable pitch

getVelData

public double getVelData()
Returns:
amplitude 0..1

getHoldData

public double getHoldData()
Returns:
hold time

setDurationData

public void setDurationData(double dur)
set performable duration, where 1.0=quarter note


setPitchData

public void setPitchData(double pitch)
set performable pitch 1..127. A Note is made into a rest by setting its pitch data to 0, followed by NoteFactory.updateFromPitch(note);


setVelData

public void setVelData(double vel)
set performable amplitude data (0..1)


setHoldData

public void setHoldData(double hold)
set performable duration of hold, where 1.0 = quarter note


setData

public void setData(double dur,
                    double midinote,
                    double vel,
                    double hold)
set four dimensional double[] data


setSelected

public void setSelected(boolean flag)
Set selected flag on Note (if user drew a rectangle that included this Note, for ex.)


getSelected

public boolean getSelected()
Returns:
true if this note is selected

getStemInfo

public int getStemInfo()
Get stem info 0=no stem, 1=stem up, 2= stem down


setStemInfo

public void setStemInfo(int stem)
Set stem info 0=no stem, 1=stem up, 2= stem down


setOverflow

public void setOverflow(boolean f)
true if this note is at the end of a track whose total durations exceeds the measure's timesig's duration. Used only for rendering


getOverflow

public boolean getOverflow()
Returns:
flag indicating whether or not this note overfills the measure it is in. Painted differently is true.

getNoteDurationAsPerformanceTime

public static double getNoteDurationAsPerformanceTime(int durConst)
Returns:
double value equal to time taken by Note.WHOLE, Note.HALF, Note.QUARTER, etc... This is the "core", or reference duration of the note, which remains constant despite dots, tuplets, etc If you add a dot or a double dot, or a triplet to a note, it is this duration which is consulted to calculate the performed duration of the note.

getNoteDurationAsPerformanceTime

public double getNoteDurationAsPerformanceTime()

getIndexOfCoreDuration

public static int getIndexOfCoreDuration(double duration)
input: duration like 0.25

Returns:
index in core durations where this duration was found, or -1 if not found

getNoteDur

public int getNoteDur()
Returns:
core duration 0..8 standing for WHOLE, HALF, QUARTER, ... 256th

getCoreDuration

public int getCoreDuration()
Synonynmous with getNoteDur()

Returns:
core duration 0..8 standing for WHOLE, HALF, QUARTER, ... 256th

setNoteDur

public void setNoteDur(int d)
Set note duration to constants 0..8 standing for WHOLE, HALF, QUARTER,... 256th


setNoteHeadType

public void setNoteHeadType(int noteheadType)
Set to Note.NOTEHEAD_BLACK or Note.NOTEHEAD_WHITE, or new constants for X, diamond, etc


getNoteHeadType

public int getNoteHeadType()
Returns:
Note.NOTEHEAD_BLACK or Note.NOTEHEAD_WHITE, or other constants for X, diamond, etc

getAcc

public int getAcc()
Returns:
accidental info for this Note, 0=none, 1=sharp, 2=flat, 3=natural

setAcc

public void setAcc(int acc)
Set accidental info 0=none, 1=sharp, 2=flat, 3=natural


getAccPref

public int getAccPref()
Indicates Note's spelling preferences if it requires an accidental

Returns:
Note.ACC_PREFER_SHARP or Note.ACC_PREFER_FLAT.

setAccPref

public void setAccPref(int pref)
Set preferred accidental spelling: Note.ACC_PREFER_SHARP or Note.ACC_PREFER_FLAT. Indicates Note's spelling preferences if it requires an accidental


getAccHidden

public boolean getAccHidden()

setAccHidden

public void setAccHidden(boolean flag)
Set accidental hidden flag 0,1


getAltEnharmonicSpelling

public boolean getAltEnharmonicSpelling()
Flag determines if note uses alternate enharmonic spelling (ex E#, F##, Cb, Fbb, etc). NoteFactory tests Note.getAccPref() ( returning Note.ACC_PREFER_SHARP or Note.ACC_PREFER_FLAT) to determine whether to be spelled with sharp or flat

Returns:
true if note is spelled with alternate enharmonic spelling

setAltEnharmonicSpelling

public void setAltEnharmonicSpelling(boolean flag)
Set flag determines if note uses alternate enharmonic spelling (ex E#, F##, Cb, Fbb, etc).


accToString

public static java.lang.String accToString(int acc)

getNumDots

public int getNumDots()

setNumDots

public void setNumDots(int n)
Set number of dots following this note, 0, 1, or 2


getBeamedOut

public boolean getBeamedOut()
Returns:
flag if this note is beamed to next note

getDynamic

public int getDynamic()
Returns:
dynamic marking for this note
                                                  
                                              DYNAMICS: 
                                                   DYNAMIC_NONE ;
                                                   DYNAMIC_PPP ;
                                                   DYNAMIC_PP ;
                                                   DYNAMIC_P ;
                                                   DYNAMIC_MP ;
                                                   DYNAMIC_MF ;
                                                   DYNAMIC_F ;
                                                   DYNAMIC_FF ;
                                                   DYNAMIC_FFF ;
                                                   
             
 

setDynamic

public void setDynamic(int dynamic)
set dynamic marking for this note
                                      
                                              DYNAMICS: 
                                                    DYNAMIC_NONE ;
                                                   DYNAMIC_PPP ;
                                                   DYNAMIC_PP ;
                                                   DYNAMIC_P ;
                                                   DYNAMIC_MP ;
                                                   DYNAMIC_MF ;
                                                   DYNAMIC_F ;
                                                   DYNAMIC_FF ;
                                                   DYNAMIC_FFF ;
                                       
 


setMark

public void setMark(int mark)
Set mark where int is one of the following:
                                                   MARK_NONE           
                                                   MARK_ACCENT         
                                                   MARK_STACCATO       
                                                   MARK_TENUTO         
                                                   MARK_WEDGE          
                                                   MARK_ACCENT_STACCATO
                                                   MARK_ACCENT_TENUTO 
                                                   MARK_WEDGE_STACCATO
                                                   MARK_FERMATA
                                                   MARK_HARMONIC       
                                                   MARK_TRILL         
                                                   MARK_TRILL_FLAT    
                                                   MARK_TRILL_SHARP   
                                                   MARK_NATURAL       
                                                   MARK_MORDANT  
                                                   MARK_INVERTED_MORDANT
              
             
 


getMark

public int getMark()

dynamicToString

public static java.lang.String dynamicToString(int dynamic)

markToString

public static java.lang.String markToString(int mark)

setBeamedOut

public void setBeamedOut(boolean f)
set the beamed out flag for this note and all intervals and handle


setBeamedOutNoLoop

public void setBeamedOutNoLoop(boolean f)

setTiedOut

public void setTiedOut(boolean flag)
Set tied out flag on Note


getTiedOut

public boolean getTiedOut()
Returns:
true if this note is tied out

setSlurredOut

public void setSlurredOut(boolean flag)
Set slur out flag on Note


getSlurredOut

public boolean getSlurredOut()
Returns:
true if this note is slurred to next

setCrescOut

public void setCrescOut(boolean flag)
Set crescendo out flag on Note. Cresc and decresc share the same bit which flags the note as being cresced or decresced to the next note. So you do not have to call setCrescOut(false) before calling setDecrescOut(true), for example. Do *not* call setCrescOut(false) *after* calling setDecrescOut(true) or their common flag will be set by the first call and unset by the second call.


setDecrescOut

public void setDecrescOut(boolean flag)
Set decrescendo out flag on Note. Cresc and decresc share the same bit which flags the note as being cresced or decresced to the next note. So you do not have to call setCrescOut(false) before calling setDecrescOut(true), for example. Do *not* call setCrescOut(false) *after* calling setDecrescOut(true) or their common flag will be set by the first call and unset by the second call.


getCrescOut

public boolean getCrescOut()
Returns:
true if this is a crescendo which continues to next note, false if it does not continue or if it is a decrescendo

getDecrescOut

public boolean getDecrescOut()
Returns:
true if this is a decrescendo which continues to next note, false if it does not continue or if it is a crescendo

set8vaOut

public void set8vaOut(boolean flag)
Set 8va out flag on Note. 8va and 8vb share the same bit which flags this property as being continued to the next note. So you do not have to call set8vaOut(false) before calling set8vbOut(true), for example. Do *not* call set8vaOut(false) *after* calling set8vbOut(true) or their common flag will be set by the first call and unset by the second call.


set8vbOut

public void set8vbOut(boolean flag)
Set 8vb out flag on Note. 8va and 8vb share the same bit which flags this property as being continued to the next note. So you do not have to call set8vaOut(false) before calling set8vbOut(true), for example. Do *not* call set8vaOut(false) *after* calling set8vbOut(true) or their common flag will be set by the first call and unset by the second call.


get8vaOut

public boolean get8vaOut()
Returns:
true if this is a 8va which continues to next note, false if it does not continue or if it is a 8vb

get8vbOut

public boolean get8vbOut()
Returns:
true if this is a 8vb which continues to next note, false if it does not continue or if it is a 8va

startOf8va

public boolean startOf8va()
Returns:
true if this note is the first of an 8va

endOf8va

public boolean endOf8va()
Returns:
true if this note is the end of an 8va

startOf8vb

public boolean startOf8vb()
Returns:
true if this note is the first of an 8vb

endOf8vb

public boolean endOf8vb()
Returns:
true if this note is the last of an 8vb

getTiedIn

public boolean getTiedIn()
Returns:
true if this note is tied in from previous note

getCrescIn

public boolean getCrescIn()
Returns:
true if this note is cresc'ed in from previous note

getDecrescIn

public boolean getDecrescIn()
Returns:
true if this note is decresc'ed in from previous note

startOfCresc

public boolean startOfCresc()
Returns:
true of this note is first note of a cresc

endOfCresc

public boolean endOfCresc()
Returns:
true of this note is last note of a cresc

startOfDecresc

public boolean startOfDecresc()
Returns:
true of this note is first note of a decresc

endOfDecresc

public boolean endOfDecresc()
Returns:
true of this note is last note of a decresc

getSlurredIn

public boolean getSlurredIn()
Returns:
true if this note is slurred in from previous note

get8vaIn

public boolean get8vaIn()
Returns:
true if this note is 8va'ed in from previous note

get8vbIn

public boolean get8vbIn()
Returns:
true if this note is 8vb'ed in from previous note

setLevel

public void setLevel(int l)
set the vertical placement of note on staff


getLevel

public int getLevel()
Returns:
the vertical placement of note on staff

setDrawingAnchor

public void setDrawingAnchor(java.awt.Point p)
anchor is the horizontal note location


replaceDrawingAnchor

public void replaceDrawingAnchor(java.awt.Point p)
anchor is the horizontal note location


getDrawingAnchor

public java.awt.Point getDrawingAnchor()
anchor is the horizontal note location


setNumTails

public void setNumTails(int n)
Deprecated. does nothing. getNumTails() is now calculated from core duration

Set the number of tails on this note (1 for eighth, 2 for 16th, etc)


getNumTails

public int getNumTails()
Returns:
the number of tails on this note, calculated from core duration as Math.max(0, getNoteDur()-2)

setStaffIndex

public void setStaffIndex(int s)
Use with caution! Only retrievable with getStaffIndex() if this note has no track or staff


getStaffIndex

public int getStaffIndex()
Returns:
staff index if track and staff != null, else return numeric staff index

setMeasureIndex

public void setMeasureIndex(int m)
Use with caution! Only retrievable with getMeasureIndex() if this note has no track or staff


getMeasureIndex

public int getMeasureIndex()
Returns:
measure index if track and staff != null, else return numeric measure index

getTuplet

public int getTuplet()
Returns:
the the tuplet value for this note. 0 if not a tuplet, else 3, 5, 7, 9, 11, etc

setTuplet

public void setTuplet(int n)
Set the tuplet value (3 for triplet, 5 for quintuplet, etc, up to 31


getTrack

public Track getTrack()
Returns:
Track to which this note belongs

getScore

public Score getScore()
Returns:
Score to which this note belongs

setTrack

public void setTrack(Track track)

getData

public double[] getData()
Returns:
internal performance data: {dur, pitch, vel, hold, .. higher dimensions}

getDataCopy

public double[] getDataCopy()
Convenience method, shorthand for getData() and System.arraycopy()

Returns:
copy of internal performance data: {dur, pitch, vel, hold, .. higher dimensions} This can be altered without affecting the Note from where it came

setData

public void setData(double[] data)

setData

public void setData(int dimension,
                    double value)
Set the value of one element of the double[] array held by this Note. You must make sure dimensions < getData().length


getData

public double getData(int dimension)
Returns:
the value at data[dimension]. You must do your own bounds checking

performExpressionMarks

public static boolean performExpressionMarks()
Returns:
flag whether or not staccato, accent staccato, and tenuto marks will affect hold time on a Note

setPerformExpressionMarks

public static void setPerformExpressionMarks(boolean flag)
if true, staccato, accent staccato, and tenuto marks will affect hold time on a Note


getPerformanceData

public double[] getPerformanceData()
translate internal performance data based on expressive properties.

Returns:
{ dur, pitch, vel, hold }

getPerformanceDataCopy

public double[] getPerformanceDataCopy()
translate internal performance data based on expressive properties.

Returns:
copy of { dur, pitch, vel, hold }

play

public double play(double playTime,
                   Composable parent,
                   Instrument ins)
Description copied from interface: InstrumentPlayable
play() is called by MusicList. It should return an updated playTime such as playTime + duration * parent.getTimeStretch()

Specified by:
play in interface InstrumentPlayable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

render

public void render(java.awt.Graphics g,
                   double zoom)

tupletDur

public static double tupletDur(int n,
                               double dur)
Calculate duration of n-tuplet, given n and its non-tuplet duration.
Algorithm: for n-tuplet, multiply the duration of the non-tuplet'ed note by the highest power of 2 that is less than n. That gives the total duration the tuplet is to occupy. Finally, divide that total duration by n.

Example: to calculate the duration of an eighth note triplet (n=3, dur=0.5):
the highest power of 2 less than 3 is 2. 2*0.5 = 1.0 which is the total duration to occupy. 1.0/3 = final duration of 0.3333

Returns:
tuplet duration applied to dur

resortChord

public static void resortChord(Note n)
make root == handle == lowest pitched note, sort the vector of intervals low to high


getSortedChord

public static Note[] getSortedChord(Note n)
Get an array containing this Note's intervals and handle in sorted order


getRoot

public static Note getRoot(Note n)
Assuming this Note is a chord, find the Note with the lowest pitch. This is NOT the same as the handle of the chord, (handle which provides the handle to a chord, and may or may not have the lowest Note of the chord.

Returns:
the Note with the lowest pitch.

getHighest

public static Note getHighest(Note n)
Assuming this Note is a chord, find the Note with the highest pitch.

Returns:
the Note with the highest pitch, or the note itself if not a chord.

getLowest

public static Note getLowest(Note n)
Assuming this Note is a chord, find the Note with the lowest pitch.

Returns:
the Note with the lowest pitch, or the note itself if not a chord.

writeXML

public void writeXML(java.io.PrintWriter out)
              throws java.io.IOException
Specified by:
writeXML in interface XMLWritable
Throws:
java.io.IOException

setDimensionNameSpace

public void setDimensionNameSpace(DimensionNameSpace d)
Specified by:
setDimensionNameSpace in interface DimensionNameSpaceEditable

getDimensionNameSpace

public DimensionNameSpace getDimensionNameSpace()
Specified by:
getDimensionNameSpace in interface DimensionNameSpaceEditable

getDoubleArray

public double[] getDoubleArray()
synonym with getData()

Specified by:
getDoubleArray in interface DimensionNameSpaceEditable

setDoubleArray

public void setDoubleArray(double[] dar)
Hand Note an entirely new array of data. Note makes a copy of array, allocates new performance data. Typically used when data dimension exceeds standard 4

Specified by:
setDoubleArray in interface DimensionNameSpaceEditable

firstNoteOfLine

public static boolean firstNoteOfLine(Note note)

lastNoteOfLine

public static boolean lastNoteOfLine(Note note)

setText

public void setText(java.lang.String s)
Set text to display by this note


getText

public java.lang.String getText()
Returns:
text to be displayed by this note

setTextOffsetX

public void setTextOffsetX(int xoffset)
horizontal text displacement


getTextOffsetX

public int getTextOffsetX()
horizontal text displacement


setTextOffsetY

public void setTextOffsetY(int yoffset)
vertical text displacement


getTextOffsetY

public int getTextOffsetY()
vertical text displacement


main

public static void main(java.lang.String[] args)