Class MIDIUtil

java.lang.Object
   |
   +----MIDIUtil

public class MIDIUtil
extends Object
Methods for handling IO, VarLenCode, Timeing ...

Variable Index

 o BAROFFSET
Marks number of first bar (typically: 0 or 1).
 o COMMENTS
Marks weather MIDITXT-files are commented (or not).
 o DENOMINATOR
Current Denominator.
 o DIVISION
Current Division.
 o FILETYPE
True if standard MIDI-file, false if ASCII MIDITXT-file.
 o GERMAN
If true, b is written as h.
 o NUMERATOR
Current Numerator.
 o PROGRAMOFFSET
Marks beginning of ProgramChange-number (typically: 0 or 1).
 o SMPTE
Current SMPTE-rate.
 o TEMPO
Current Tempo.

Constructor Index

 o MIDIUtil()

Method Index

 o getAbsTime(String)
Returns value of absTime in ticks, represented by PPQN-String.
 o getInt(int, FileInputStream)
Returns value read from file.
 o getLine(FileInputStream)
Returns String representing a Line read from file.
 o getNextToken(FileInputStream)
Returns Token read from file.
 o getNextValidToken(FileInputStream)
Returns valid Token read from file.
 o getString(int, FileInputStream)
Returns String read from file.
 o getTicks()
Returns number of ticks, each beat endures.
 o getVarLen(int[], FileInputStream)
Returns value stored as VariableLengthCode in file.
 o putComment(String, FileOutputStream)
Writes comment to file.
 o putCopyright(FileOutputStream)
Writes copyright-comments to file.
 o putInt(int, int, FileOutputStream)
Writes int to file.
 o putString(String, FileOutputStream)
Writes String to file.
 o putString(String, int, FileOutputStream)
Writes String to file.
 o putVarLen(int, FileOutputStream)
Writes value as VariableLengthCode to file.
 o setBarOffset(int)
Sets BAROFFSET.
 o setComments(boolean)
Sets current COMMENTS.
 o setDenominator(int)
Sets current DENOMINATOR.
 o setDivision(int)
Sets current DIVISION.
 o setFileType(boolean)
Sets FILETYPE.
 o setGerman(boolean)
Sets GERMAN.
 o setNumerator(int)
Sets current NUMERATOR.
 o setProgramOffset(int)
Sets PROGRAMOFFSET.
 o setSmpte(int)
Sets current SMPTE.
 o setTempo(int)
Sets current TEMPO.
 o skipLine(FileInputStream)
Skips all Bytes in the current line from file.

Variables

 o NUMERATOR
 static int NUMERATOR
Sets current Numerator (typically 3 or 4).

 o DENOMINATOR
 static int DENOMINATOR
Sets current Denominator (note: 2=quarters 3=eights ...).

 o TEMPO
 static int TEMPO
Sets current Tempo (in microSeconds, 500.000 = 120 BPM).

 o SMPTE
 static int SMPTE
Sets current SMPTE-rate (24,25,29 or 29 FPS; 0 for OFF).

 o DIVISION
 static int DIVISION
Sets current Division (typically: 192,384 for PPQN; 20,40,80 for SMPTE).

 o FILETYPE
 static boolean FILETYPE
If true: file is standard MIDI-file; if false: file is an ASCII-file.

 o COMMENTS
 static boolean COMMENTS
If true: comments are added to MIDITXT-file.

 o GERMAN
 static boolean GERMAN
If true: the note b is written as h.

 o PROGRAMOFFSET
 static int PROGRAMOFFSET
Marks beginning of ProgramChange-number (typically: 0 or 1).

 o BAROFFSET
 static int BAROFFSET
Marks number of first bar (typically: 0 or 1).

Constructors

 o MIDIUtil
 public MIDIUtil()

Methods

 o setNumerator
 public static void setNumerator(int i)
Sets current NUMERATOR to i.

 o setDenominator
 public static void setDenominator(int i)
Sets current DENOMINATOR to i.

 o setTempo
 public static void setTempo(int i)
Sets current TEMPO to i.

 o setSmpte
 public static void setSmpte(int i)
Sets current SMPTE-rate to i.

 o setDivision
 public static void setDivision(int i)
Sets current DIVISION to i.

 o setComments
 public static void setComments(boolean b)
Sets COMMENTS to b.

 o setFileType
 public static void setFileType(boolean b)
Sets FILETYPE to b.

 o setGerman
 public static void setGerman(boolean b)
Sets GERMAN to b.

 o setProgramOffset
 public static void setProgramOffset(int i)
Sets PROGRAMOFFSET to i.

 o setBarOffset
 public static void setBarOffset(int i)
Sets BAROFFSET to i.

 o getTicks
 public static double getTicks()
Returns value representing the ticks each beat endures.
Needed to represent absTime in PPQN-notation.

 o getAbsTime
 public static int getAbsTime(String s) throws MIDIException
Returns absTime represented by String s.
Throws Exception if s is not in PPQN-notation.

 o getInt
 public static int getInt(int length,
                          FileInputStream fpp) throws MIDIException
Returns int represented by length Bytes read from file fpp.
Throws Exception if IOError occurs.

 o putInt
 public static void putInt(int value,
                           int length,
                           FileOutputStream fpp) throws MIDIException
Writes value to file fpp, using length Bytes.
Throws Exception if IOError occurs.

 o getVarLen
 public static int getVarLen(int count[],
                             FileInputStream fpp) throws MIDIException
Reads value stored as VLC from file fpp.
Number of read Bytes is stored in count[0].
Throws Exception if IOError occurs.

 o putVarLen
 public static void putVarLen(int value,
                              FileOutputStream fpp) throws MIDIException
Writes value as VLC to file fpp.
Throws Exception if IOError occurs.

 o getString
 public static String getString(int length,
                                FileInputStream fpp) throws MIDIException
Reads length Bytes from file fpp, and returns them as a String.
Throws Exception if IOError occurs.

 o putString
 public static void putString(String s,
                              int length,
                              FileOutputStream fpp) throws MIDIException
Writes only lenght Chars of String s to file fpp.
Throws Exception if IOError occurs.

 o putString
 public static void putString(String s,
                              FileOutputStream fpp) throws MIDIException
Writes String s to file fpp.
Throws Exception if IOError occurs.

 o putComment
 public static void putComment(String s,
                               FileOutputStream fpp) throws MIDIException
Writes String s as comment to file fpp.
Throws Exception if IOError occurs.

 o putCopyright
 public static void putCopyright(FileOutputStream fpp) throws MIDIException
Writes copyright-comments to file fpp.
Throws Exception if IOError occurs.

 o getLine
 public static String getLine(FileInputStream fpp) throws MIDIException
Reads a line from file fpp, and returns it as a String.
Throws Exception if IOError occurs.

 o skipLine
 public static void skipLine(FileInputStream fpp) throws MIDIException
Skips all Bytes in the current line from file fpp.
Throws Exception if IOError occurs.

 o getNextToken
 public static String getNextToken(FileInputStream fpp) throws MIDIException
Returns a String representing a Token read from file fpp.
Returns EOF if no more token can be found in file fpp.
Throws Exception if IOError occurs.

 o getNextValidToken
 public static String getNextValidToken(FileInputStream fpp) throws MIDIException
Returns a String representing a valid Token read from file fpp.
Throws Exception if IOError occurs.