Class Note

    • Field Detail

      • originalString

        public java.lang.String originalString
      • NOTE_NAMES_COMMON

        public static final java.lang.String[] NOTE_NAMES_COMMON
      • NOTE_NAMES_SHARP

        public static final java.lang.String[] NOTE_NAMES_SHARP
      • NOTE_NAMES_FLAT

        public static final java.lang.String[] NOTE_NAMES_FLAT
      • PERCUSSION_NAMES

        public static final java.lang.String[] PERCUSSION_NAMES
      • REST

        public static final Note REST
    • Constructor Detail

      • Note

        public Note()
      • Note

        public Note​(java.lang.String note)
      • Note

        public Note​(Note note)
      • Note

        public Note​(int value)
      • Note

        public Note​(byte value)
      • Note

        public Note​(int value,
                    double duration)
      • Note

        public Note​(byte value,
                    double duration)
    • Method Detail

      • setValue

        public Note setValue​(byte value)
      • getValue

        public byte getValue()
      • changeValue

        public Note changeValue​(int delta)
      • setOctaveExplicitlySet

        public Note setOctaveExplicitlySet​(boolean set)
      • getOctave

        public byte getOctave()
      • getDuration

        public double getDuration()
      • setDuration

        public Note setDuration​(double d)
      • useDefaultDuration

        public Note useDefaultDuration()
      • useSameDurationAs

        public Note useSameDurationAs​(Note note2)
      • useSameExplicitOctaveSettingAs

        public Note useSameExplicitOctaveSettingAs​(Note note2)
      • setDuration

        public Note setDuration​(java.lang.String duration)
      • isDurationExplicitlySet

        public boolean isDurationExplicitlySet()
      • isOctaveExplicitlySet

        public boolean isOctaveExplicitlySet()
      • setImplicitDurationForTestingOnly

        public Note setImplicitDurationForTestingOnly​(double d)
        FOR TESTING PURPOSES ONLY - avoids setting "isDurationExplicitlySet" - Please use setDuration instead!
      • setRest

        public Note setRest​(boolean rest)
      • isRest

        public boolean isRest()
      • setPercussionNote

        public Note setPercussionNote​(boolean perc)
      • isPercussionNote

        public boolean isPercussionNote()
      • setOnVelocity

        public Note setOnVelocity​(byte velocity)
      • getOnVelocity

        public byte getOnVelocity()
      • setOffVelocity

        public Note setOffVelocity​(byte velocity)
      • getOffVelocity

        public byte getOffVelocity()
      • setStartOfTie

        public Note setStartOfTie​(boolean isStartOfTie)
      • setEndOfTie

        public Note setEndOfTie​(boolean isEndOfTie)
      • isStartOfTie

        public boolean isStartOfTie()
      • isEndOfTie

        public boolean isEndOfTie()
      • setFirstNote

        public Note setFirstNote​(boolean isFirstNote)
      • isFirstNote

        public boolean isFirstNote()
      • setMelodicNote

        public Note setMelodicNote​(boolean isMelodicNote)
      • isMelodicNote

        public boolean isMelodicNote()
      • setHarmonicNote

        public Note setHarmonicNote​(boolean isHarmonicNote)
      • isHarmonicNote

        public boolean isHarmonicNote()
      • setOriginalString

        public Note setOriginalString​(java.lang.String originalString)
      • getOriginalString

        public java.lang.String getOriginalString()
      • getMicrosecondDuration

        public double getMicrosecondDuration​(double mpq)
      • getPositionInOctave

        public byte getPositionInOctave()
      • isSameNote

        public static boolean isSameNote​(java.lang.String note1,
                                         java.lang.String note2)
      • sortNotesBy

        public static void sortNotesBy​(Note[] notes,
                                       org.jfugue.theory.Note.SortingCallback callback)
        This is just Bubble Sort, but allows you to pass a Note.SortingCallback that returns a value that you want to sort for a note. For example, to sort based on position in octave, your SortingCallback would return note.getPositionInOctave(). This lets you sort by note value, octave, position in octave, duration, velocity, and so on.
      • createRest

        public static Note createRest​(double duration)
      • getToneString

        public static java.lang.String getToneString​(byte noteValue)
        Returns a MusicString representation of the given MIDI note value, which indicates a note and an octave.
        Parameters:
        noteValue - this MIDI note value, like 60
        Returns:
        a MusicString value, like C5
      • getToneStringWithoutOctave

        public static java.lang.String getToneStringWithoutOctave​(byte noteValue)
        Returns a MusicString representation of the given MIDI note value, but just the note - not the octave. This means that the value returned can not be used to accurately recalculate the noteValue, since information will be missing. But this is useful for knowing what note within any octave the corresponding value belongs to.
        Parameters:
        noteValue - this MIDI note value, like 60
        Returns:
        a MusicString value, like C
      • getDispositionedToneStringWithoutOctave

        public static java.lang.String getDispositionedToneStringWithoutOctave​(int dispose,
                                                                               byte noteValue)
        Returns a MusicString representation of the given MIDI note value, just the note (not the octave), disposed to use either flats or sharps. Pass -1 to get a flat name and +1 to get a sharp name for any notes that are accidentals.
        Parameters:
        dispose - -1 to get a flat value, +1 to get a sharp value
        noteValue - this MIDI note value, like 61
        Returns:
        a MusicString value, like Db if -1 or C# if +1
      • getPercussionString

        public static java.lang.String getPercussionString​(byte noteValue)
        Returns a MusicString representation of the given MIDI note value using the name of a percussion instrument.
        Parameters:
        noteValue - this MIDI note value, like 60
        Returns:
        a MusicString value, like [AGOGO]
      • getFrequencyForNote

        public static double getFrequencyForNote​(java.lang.String note)
        Returns the frequency, in Hertz, for the given note. For example, the frequency for A5 (MIDI note 69) is 440.0
        Parameters:
        noteValue - the MIDI note value
        Returns:
        frequency in Hertz
      • getFrequencyForNote

        public static double getFrequencyForNote​(int noteValue)
        Returns the frequency, in Hertz, for the given note value. For example, the frequency for A5 (MIDI note 69) is 440.0
        Parameters:
        noteValue - the MIDI note value
        Returns:
        frequency in Hertz
      • isValidNote

        public static boolean isValidNote​(java.lang.String candidateNote)
      • isValidQualifier

        public static boolean isValidQualifier​(java.lang.String candidateQualifier)
      • getDurationString

        public static java.lang.String getDurationString​(double decimalDuration)
        Returns a MusicString representation of a decimal duration. This code currently only converts single duration values representing whole, half, quarter, eighth, etc. durations; and dotted durations associated with those durations (such as "h.", equal to 0.75). This method does not convert combined durations (for example, "hi" for 0.625). For these values, the original decimal duration is returned in a string, prepended with a "/" to make the returned value a valid MusicString duration indicator. It does handle durations greater than 1.0 (for example, "wwww" for 4.0).
        Parameters:
        decimalDuration - The decimal value of the duration to convert
        Returns:
        a MusicString fragment representing the duration
      • getDurationStringForBeat

        public static java.lang.String getDurationStringForBeat​(int beat)
      • getVelocityString

        public java.lang.String getVelocityString()
      • getPattern

        public Pattern getPattern()
        Returns a pattern representing this note. Does not return indicators of whether the note is harmonic or melodic.
        Specified by:
        getPattern in interface PatternProducer
      • getPercussionPattern

        public Pattern getPercussionPattern()
      • toString

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

        public java.lang.String toStringWithoutDuration()
      • getToneString

        public java.lang.String getToneString()
      • getDecoratorString

        public java.lang.String getDecoratorString()
        Returns the "decorators" to the base note, which includes the duration if one is explicitly specified, and velocity dynamics if provided
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toDebugString

        public java.lang.String toDebugString()