Class MidiStringFormatter

java.lang.Object
eu.bandm.music.midi.MidiStringFormatter

public class MidiStringFormatter extends Object
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 Details

    • language

      String language
      Language for pitch class names and octave names. Defaults to "de".
    • DEFAULT_NO_WHEN_PLACEHOLDER

      public static final String DEFAULT_NO_WHEN_PLACEHOLDER
      String to print when no timepoint information is to be printed.
      See Also:
    • noWhenPlaceholder

      String noWhenPlaceholder
      String 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_GIVEN
      Used 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

      public MidiStringFormatter setLanguage(String language)
      Change the language for pitch class names and octave names.
    • setNoWhenPlaceholder

      public MidiStringFormatter setNoWhenPlaceholder(String noWhenPlaceholder)
      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

      protected String getKeyName(int i)
      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

      public String decode(MidiMessage message, long when)
      Calculate a human-readable string which represents a time value and a MIDI message. If the time value equals NO_TIME_GIVEN, then a placeholder is inserted instead.
    • decode

      public String decode(MidiMessage message)
      Calculate a human-readable string which represents a MIDI message.
    • decode

      public final String decode(ShortMessage message)
      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

      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.
    • decode_keyAndVelocity

      protected String decode_keyAndVelocity(String command, ShortMessage message)
      Calculate a human-readable string which represents a MIDI message with key and velocity values.
    • decode

      public static final String decode(SysexMessage message)
    • decode

      public static final String decode(MetaMessage message)