Package eu.bandm.music.midi
Class MidiStringFormatter
java.lang.Object
eu.bandm.music.midi.MidiStringFormatter
Convert a MIDI event or a MIDI message into human-readable text.
(Parts of this source text are inspired by "jsresources.org/DumpReceiver"
by Matthias Pfisterer, Florian Bomers:
http://www.jsresources.org/examples/DumpReceiver.java.html )
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
String to print when no timepoint information is to be printed.(package private) String
Language for pitch class names and octave names.static final long
Used to indicate as a time value that no time value shall be displayed.(package private) String
String to print when no timepoint information is to be printed.(package private) TwelveToneFunctionalRepresentation
A mapping from the keyboard keys of one octave to spelled pitch classes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final String
decode
(MetaMessage message) decode
(MidiMessage message) Calculate a human-readable string which represents a MIDI message.decode
(MidiMessage message, long when) Calculate a human-readable string which represents a time value and a MIDI message.final String
decode
(ShortMessage message) Calculate a human-readable string which represents a MIDI message of short type.static final String
decode
(SysexMessage message) protected String
decode_data
(ShortMessage message) Calculate a human-readable string which represents a MIDI message of short type, which is not a system message.protected String
decode_keyAndVelocity
(String command, ShortMessage message) Calculate a human-readable string which represents a MIDI message with key and velocity values.protected String
getKeyName
(int i) Get the human-readable name for the keyboard key with the given index.setLanguage
(String language) Change the language for pitch class names and octave names.setNoWhenPlaceholder
(String noWhenPlaceholder) Set the string to print when no timepoint information is to be printed.Set the mapping from the keyboard keys of one octave to spelled pitch classes.
-
Field Details
-
language
String languageLanguage for pitch class names and octave names. Defaults to "de". -
DEFAULT_NO_WHEN_PLACEHOLDER
String to print when no timepoint information is to be printed.- See Also:
-
noWhenPlaceholder
String noWhenPlaceholderString to print when no timepoint information is to be printed. -
repr12
A mapping from the keyboard keys of one octave to spelled pitch classes. -
NO_TIME_GIVEN
public static final long NO_TIME_GIVENUsed to indicate as a time value that no time value shall be displayed.- See Also:
-
-
Constructor Details
-
MidiStringFormatter
public MidiStringFormatter()Only constructor.
-
-
Method Details
-
setLanguage
Change the language for pitch class names and octave names. -
setNoWhenPlaceholder
Set the string to print when no timepoint information is to be printed. -
setTwelveToneFunctionalRepresentation
public MidiStringFormatter setTwelveToneFunctionalRepresentation(TwelveToneFunctionalRepresentation rep) Set the mapping from the keyboard keys of one octave to spelled pitch classes. -
getKeyName
Get the human-readable name for the keyboard key with the given index. Name is the pitch-class name followed by the octave name. -
decode
Calculate a human-readable string which represents a time value and a MIDI message. If the time value equalsNO_TIME_GIVEN
, then a placeholder is inserted instead. -
decode
Calculate a human-readable string which represents a MIDI message. -
decode
Calculate a human-readable string which represents a MIDI message of short type. This is command and channel in the first byte, and key number and value in two following bytes. -
decode_data
Calculate a human-readable string which represents a MIDI message of short type, which is not a system message. -
decode_keyAndVelocity
Calculate a human-readable string which represents a MIDI message with key and velocity values. -
decode
-
decode
-