Class Note

java.lang.Object
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 Details

  • Constructor Details

    • 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 Details

    • cloneNote

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

      public byte getAccidentalVisibilityPolicy()
      One of: ACCIDENTAL_SHOW_NORMAL, ACCIDENTAL_SHOW_NEVER, ACCIDENTAL_SHOW_ALWAYS
      Returns:
      the accidentalVisibilityPolicy
    • setAccidentalVisibilityPolicy

      public void setAccidentalVisibilityPolicy​(byte accidentalVisibilityPolicy)
      One of: ACCIDENTAL_SHOW_NORMAL, ACCIDENTAL_SHOW_NEVER, ACCIDENTAL_SHOW_ALWAYS
      Parameters:
      accidentalVisibilityPolicy - the accidentalVisibilityPolicy to set
    • isLedgerLinesVisible

      public boolean isLedgerLinesVisible()
      Returns:
      the ledger line visibility flag
    • setLedgerLinesVisible

      public void setLedgerLinesVisible​(boolean showLedgerLines)
      Parameters:
      turn - ledger line visibility on or off
    • 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)
    • setGraceNotesToTrackOfParent

      public static void setGraceNotesToTrackOfParent​(Note note)
    • getLayoutShiftX

      public double getLayoutShiftX()
      you can nudge a note left or right
      Returns:
      the layoutShiftX
    • setLayoutShiftX

      public void setLayoutShiftX​(double layoutShiftX)
      you can nudge a note left or right
      Parameters:
      layoutShiftX - the layoutShiftX to set
    • 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
    • setGraceNotes

      public void setGraceNotes​(java.util.Vector graceNotes)
    • isFirstGraceNote

      public boolean isFirstGraceNote()
    • addGraceNote

      public Note addGraceNote​(Note graceNote)
    • addGraceNote

      public Note addGraceNote​(double duration, double pitch, double amp, double hold, boolean accPreferSharp, boolean beamedOut, boolean slurredOut, boolean tiedOut, boolean slashed, int mark)
    • removeGraceNote

      public void removeGraceNote​(Note graceNote)
    • getGraceNoteHandle

      public Note getGraceNoteHandle()
      A grace note has a pointer to the note which it is attached to.
      Returns:
      Returns the graceNoteHandle.
    • setGraceNoteHandle

      public void setGraceNoteHandle​(Note graceNoteHandle)
      Parameters:
      graceNoteHandle - The graceNoteHandle to set.
    • removeAllGraceNotes

      public void removeAllGraceNotes()
    • 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 newInterval)
      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()
      If this Note is an interval, get the root of the chord (called the handle)
      Returns:
      handle of chord
    • getIntervals

      public java.util.Vector getIntervals()
    • getNoteheadScale

      public double getNoteheadScale()
      Returns:
      the noteheadScale (default is 1.0)
    • setNoteheadScale

      public void setNoteheadScale​(double noteheadScale)
      Parameters:
      noteheadScale - the noteheadScale to set (where 1.0 is default)
    • 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
    • isNoteheadVisible

      public boolean isNoteheadVisible()
    • setNoteheadVisible

      public void setNoteheadVisible​(boolean flag)
    • isStemVisible

      public boolean isStemVisible()
      Get visibility flag of this note's stem. Not the same as a whole note not having a stem versus a half note having a stem. This flag hides stem rendering on a note, whether or not is has a stem. So this would return true for a unaltered (default) whole note.
      Returns:
      true is stem is visible, false otherwise.
    • setStemVisible

      public void setStemVisible​(boolean visible)
      Set visibility of this note's stem. Not the same as a whole note not having a stem versus a half note having a stem. This hides stem rendering on a note, whether or not is has a stem.
    • 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
    • getStemInfoOverride

      public boolean getStemInfoOverride()
    • setStemInfoOverride

      public void setStemInfoOverride​(int stem)
      override stem direction. Use wisely. NoteFactory will use this value instead of setting it itself. stem info 0=no stem, 1=stem up, 2= stem down
    • clearStemInfoOverride

      public void clearStemInfoOverride()
    • 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, 4= DOUBLE FLAT, 5= DOUBLE SHARP
    • 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
    • getGlissOut

      public boolean getGlissOut()
    • 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)
      Deprecated.
      use addMark() instead
    • addMark

      public void addMark​(int mark)
      add a mark to this note. If mark == MARK_NONE that clears all marks
    • getMark

      public int getMark()
      Just returns first of marks. Use getMarks() instead to return Vector of Integer marks
    • getMarks

      public java.util.Vector getMarks()
      Returns:
      Vector of Integer whose intValue is a mark
    • 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
    • setGlissOut

      public void setGlissOut​(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
    • setVisible

      public void setVisible​(boolean flag)
      Set visible flag on Note. If false, NoteRenderer will not render it.
    • isVisible

      public boolean isVisible()
      Returns:
      true if this note is visible
    • isGraceNote

      public boolean isGraceNote()
    • setIsGraceNote

      public void setIsGraceNote​(boolean flag)
      Set flag determines if note is a grace note
    • getGraceNotes

      public java.util.Vector getGraceNotes()
    • getNumGraceNotes

      public int getNumGraceNotes()
    • getCompleteIndexArray

      public int[] getCompleteIndexArray()
    • 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)
      Deprecated.
      Misnomer. No longer flags 8va to next note. Only indicates that 8va applied to this note. Now a single note can have 8va over it
    • set8vbOut

      public void set8vbOut​(boolean flag)
      Deprecated.
      Misnomer. No longer flags 8vb to next note. Only indicates that 8vb applied to this note. Now a single note can have 8vb over it
    • set8va

      public void set8va​(boolean flag)
      Set 8va property on Note. Since build 20070707 this property can be set on a single note, and no longer flags 8va extended to next note.
    • set8vb

      public void set8vb​(boolean flag)
      Set 8vb property on Note. Since build 20070707 this propperty can be set on a single note, and no longer flags 8vb extended to next note.
    • get8vaOut

      public boolean get8vaOut()
      Deprecated.
      Misnomer. No longer flags whether 8va to next note. Only indicates that 8va applied to this note.
      Returns:
      is8va()
    • get8vbOut

      public boolean get8vbOut()
      Deprecated.
      Misnomer. No longer flags whether 8vb to next note. Only indicates that 8vb applied to this note.
      Returns:
      is8vb()
    • is8va

      public boolean is8va()
      Returns:
      true if this note has ottava alta property
    • is8vb

      public boolean is8vb()
      Returns:
      true if this note has ottava bassa property
    • 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
    • isOverrideLevel

      public boolean isOverrideLevel()
      Returns:
      the isOverrideLevel
    • setOverrideLevel

      public void setOverrideLevel​(boolean isOverrideLevel)
      Parameters:
      isOverrideLevel - the isOverrideLevel to set
    • setOverrideLevel

      public void setOverrideLevel​(int overrideLevel)
      overrideLevel is the level the user can set to force a note to be rendered at specified level This value is stored and expressed in rendering if isOverrideLevel() is true
      Parameters:
      overrideLevel -
    • getOverrideLevel

      public int getOverrideLevel()
      Returns:
      the overrideLevel
    • setDrawingAnchor

      public void setDrawingAnchor​(java.awt.geom.Point2D p)
      anchor is the horizontal note location
    • replaceDrawingAnchor

      public void replaceDrawingAnchor​(java.awt.geom.Point2D p)
      anchor is the horizontal note location
    • getDrawingAnchor

      public java.awt.geom.Point2D 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 }
    • calcGraceNoteRollbackTime

      public double calcGraceNoteRollbackTime()
    • 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
    • getGraceNoteSeparationScaler

      public double getGraceNoteSeparationScaler()
      Returns:
      the graceNoteSeparationScaler
    • setGraceNoteSeparationScaler

      public void setGraceNoteSeparationScaler​(double graceNoteSeparationScaler)
      Parameters:
      graceNoteSeparationScaler - the graceNoteSeparationScaler to set
    • setXPositionsOfGraceNotes

      public void setXPositionsOfGraceNotes()
    • 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
    • writeXML

      public void writeXML​(java.io.PrintWriter out, boolean includeIntervals) throws java.io.IOException
      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)
    • getUserBeans

      public java.util.Vector getUserBeans()
      A Note can have a vector of custom user-defined beans attached to it. These will be saved to a file with a Score and reloaded as well. The objects must be beans (ie have private simple data types with matching getters and setters.
      Returns:
      Returns vector of beans.
    • addUserBean

      public void addUserBean​(java.lang.Object bean)
      Add a bean to a note. A bean is an object with primitive fields and matching getters and setters. These will be restored when loaded.
      Parameters:
      bean - The bean to add.
    • removeUserBean

      public void removeUserBean​(java.lang.Object bean)
    • getAccidentalOffset

      public int getAccidentalOffset()
      Returns:
      Returns the accidentalOffset.
    • setAccidentalOffset

      public void setAccidentalOffset​(int accidentalOffset)
      Parameters:
      accidentalOffset - The accidentalOffset to set.
    • getNoteheadColor

      public java.awt.Color getNoteheadColor()
      Returns:
      Returns the noteheadColor.
    • setNoteheadColor

      public void setNoteheadColor​(java.awt.Color noteheadColor)
      Parameters:
      noteheadColor - The noteheadColor to set.
    • stemDirection

      public static java.lang.String stemDirection​(int x)
    • setDimensionNameSpaceDefaults

      public void setDimensionNameSpaceDefaults()