public class Note extends java.lang.Object implements PatternProducer
Modifier and Type | Field and Description |
---|---|
static byte |
MAX_OCTAVE |
static byte |
MIN_OCTAVE |
static java.lang.String[] |
NOTE_NAMES_COMMON |
static java.lang.String[] |
NOTE_NAMES_FLAT |
static java.lang.String[] |
NOTE_NAMES_SHARP |
static byte |
OCTAVE |
java.lang.String |
originalString |
static java.lang.String[] |
PERCUSSION_NAMES |
static Note |
REST |
Constructor and Description |
---|
Note() |
Note(byte value) |
Note(byte value,
double duration) |
Note(int value) |
Note(int value,
double duration) |
Note(Note note) |
Note(java.lang.String note) |
Modifier and Type | Method and Description |
---|---|
Note |
changeValue(int delta) |
static Note |
createRest(double duration) |
boolean |
equals(java.lang.Object o) |
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
|
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.
|
double |
getDuration() |
static java.lang.String |
getDurationString(double decimalDuration)
Returns a MusicString representation of a decimal duration.
|
static java.lang.String |
getDurationStringForBeat(int beat) |
static double |
getFrequencyForNote(int noteValue)
Returns the frequency, in Hertz, for the given note value.
|
static double |
getFrequencyForNote(java.lang.String note)
Returns the frequency, in Hertz, for the given note.
|
double |
getMicrosecondDuration(double mpq) |
byte |
getOctave() |
byte |
getOffVelocity() |
byte |
getOnVelocity() |
java.lang.String |
getOriginalString() |
Pattern |
getPattern()
Returns a pattern representing this note.
|
Pattern |
getPercussionPattern() |
static java.lang.String |
getPercussionString(byte noteValue)
Returns a MusicString representation of the given MIDI note value
using the name of a percussion instrument.
|
byte |
getPositionInOctave() |
java.lang.String |
getToneString() |
static java.lang.String |
getToneString(byte noteValue)
Returns a MusicString representation of the given MIDI note value,
which indicates a note and an octave.
|
static java.lang.String |
getToneStringWithoutOctave(byte noteValue)
Returns a MusicString representation of the given MIDI note value,
but just the note - not the octave.
|
byte |
getValue() |
java.lang.String |
getVelocityString() |
boolean |
isDurationExplicitlySet() |
boolean |
isEndOfTie() |
boolean |
isFirstNote() |
boolean |
isHarmonicNote() |
boolean |
isMelodicNote() |
boolean |
isOctaveExplicitlySet() |
boolean |
isPercussionNote() |
boolean |
isRest() |
static boolean |
isSameNote(java.lang.String note1,
java.lang.String note2) |
boolean |
isStartOfTie() |
static boolean |
isValidNote(java.lang.String candidateNote) |
static boolean |
isValidQualifier(java.lang.String candidateQualifier) |
Note |
setDuration(double d) |
Note |
setDuration(java.lang.String duration) |
Note |
setEndOfTie(boolean isEndOfTie) |
Note |
setFirstNote(boolean isFirstNote) |
Note |
setHarmonicNote(boolean isHarmonicNote) |
Note |
setImplicitDurationForTestingOnly(double d)
FOR TESTING PURPOSES ONLY - avoids setting "isDurationExplicitlySet" - Please use setDuration instead!
|
Note |
setMelodicNote(boolean isMelodicNote) |
Note |
setOctaveExplicitlySet(boolean set) |
Note |
setOffVelocity(byte velocity) |
Note |
setOnVelocity(byte velocity) |
Note |
setOriginalString(java.lang.String originalString) |
Note |
setPercussionNote(boolean perc) |
Note |
setRest(boolean rest) |
Note |
setStartOfTie(boolean isStartOfTie) |
Note |
setValue(byte value) |
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.
|
java.lang.String |
toDebugString() |
java.lang.String |
toString() |
java.lang.String |
toStringWithoutDuration() |
Note |
useDefaultDuration() |
Note |
useSameDurationAs(Note note2) |
Note |
useSameExplicitOctaveSettingAs(Note note2) |
public java.lang.String originalString
public static final java.lang.String[] NOTE_NAMES_COMMON
public static final java.lang.String[] NOTE_NAMES_SHARP
public static final java.lang.String[] NOTE_NAMES_FLAT
public static final java.lang.String[] PERCUSSION_NAMES
public static final Note REST
public static final byte OCTAVE
public static final byte MIN_OCTAVE
public static final byte MAX_OCTAVE
public Note()
public Note(java.lang.String note)
public Note(Note note)
public Note(int value)
public Note(byte value)
public Note(int value, double duration)
public Note(byte value, double duration)
public Note setValue(byte value)
public byte getValue()
public Note changeValue(int delta)
public Note setOctaveExplicitlySet(boolean set)
public byte getOctave()
public double getDuration()
public Note setDuration(double d)
public Note useDefaultDuration()
public Note setDuration(java.lang.String duration)
public boolean isDurationExplicitlySet()
public boolean isOctaveExplicitlySet()
public Note setImplicitDurationForTestingOnly(double d)
public Note setRest(boolean rest)
public boolean isRest()
public Note setPercussionNote(boolean perc)
public boolean isPercussionNote()
public Note setOnVelocity(byte velocity)
public byte getOnVelocity()
public Note setOffVelocity(byte velocity)
public byte getOffVelocity()
public Note setStartOfTie(boolean isStartOfTie)
public Note setEndOfTie(boolean isEndOfTie)
public boolean isStartOfTie()
public boolean isEndOfTie()
public Note setFirstNote(boolean isFirstNote)
public boolean isFirstNote()
public Note setMelodicNote(boolean isMelodicNote)
public boolean isMelodicNote()
public Note setHarmonicNote(boolean isHarmonicNote)
public boolean isHarmonicNote()
public Note setOriginalString(java.lang.String originalString)
public java.lang.String getOriginalString()
public double getMicrosecondDuration(double mpq)
public byte getPositionInOctave()
public static boolean isSameNote(java.lang.String note1, java.lang.String note2)
public static void sortNotesBy(Note[] notes, org.jfugue.theory.Note.SortingCallback callback)
public static Note createRest(double duration)
public static java.lang.String getToneString(byte noteValue)
noteValue
- this MIDI note value, like 60public static java.lang.String getToneStringWithoutOctave(byte noteValue)
noteValue
- this MIDI note value, like 60public static java.lang.String getDispositionedToneStringWithoutOctave(int dispose, byte noteValue)
dispose
- -1 to get a flat value, +1 to get a sharp valuenoteValue
- this MIDI note value, like 61public static java.lang.String getPercussionString(byte noteValue)
noteValue
- this MIDI note value, like 60public static double getFrequencyForNote(java.lang.String note)
noteValue
- the MIDI note valuepublic static double getFrequencyForNote(int noteValue)
noteValue
- the MIDI note valuepublic static boolean isValidNote(java.lang.String candidateNote)
public static boolean isValidQualifier(java.lang.String candidateQualifier)
public static java.lang.String getDurationString(double decimalDuration)
decimalDuration
- The decimal value of the duration to convertpublic static java.lang.String getDurationStringForBeat(int beat)
public java.lang.String getVelocityString()
public Pattern getPattern()
getPattern
in interface PatternProducer
public Pattern getPercussionPattern()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringWithoutDuration()
public java.lang.String getToneString()
public java.lang.String getDecoratorString()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toDebugString()