MidiFileFormat object encapsulates a MIDI file's type, as well as
its length and timing information.
A MidiFileFormat object can include a set of properties. A property
is a pair of key and value: the key is of type String, the associated
property value is an arbitrary object. Properties specify additional
informational meta data (like a author, or copyright). Properties are
optional information, and file reader and file writer implementations are not
required to provide or recognize properties.
The following table lists some common properties that should be used in implementations:
| Property key | Value type | Description |
|---|---|---|
| "author" | String
| name of the author of this file |
| "title" | String
| title of this file |
| "copyright" | String
| copyright message |
| "date" | Date
| date of the recording or release |
| "comment" | String
| an arbitrary text |
MidiSystem#getMidiFileFormat(java.io.File) , Sequencer#setSequence(java.io.InputStream stream)
| Modifier and Type | Field and Description |
|---|---|
| protected int | byteLength
The length of the MIDI file in bytes. |
| protected float | divisionType
The division type of the MIDI file. |
| protected long | microsecondLength
The duration of the MIDI file in microseconds. |
| private HashMap | properties
The set of properties. |
| protected int | resolution
The timing resolution of the MIDI file. |
| protected int | type
The type of MIDI file. |
| public static final int | UNKNOWN_LENGTH
Represents unknown length. |
| Access | Constructor and Description |
|---|---|
| public | MidiFileFormat(int
the MIDI file type (0, 1, or 2) type, float the timing division type (PPQ or one of the SMPTE
types) divisionType, int the timing resolution resolution, int the length of the MIDI file in bytes, or
bytes, long UNKNOWN_LENGTH if not knownthe duration of the file in microseconds, or
microseconds)UNKNOWN_LENGTH if not knownConstructs a |
| public | MidiFileFormat(int
the MIDI file type (0, 1, or 2) type, float the timing division type (PPQ or one of the SMPTE
types) divisionType, int the timing resolution resolution, int the length of the MIDI file in bytes, or
bytes, long UNKNOWN_LENGTH if not knownthe duration of the file in microseconds, or
microseconds, Map<String, Object> UNKNOWN_LENGTH if not knowna properties)Map<String,Object> object with propertiesConstruct a |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the number of bytes in the file, orUNKNOWN_LENGTH if not
knownObtains the length of the MIDI file, expressed in 8-bit bytes. |
| public float | Returns: the division type (PPQ or one of the SMPTE types)Obtains the timing division type for the MIDI file. |
| public long | Returns: the file's duration in microseconds, orUNKNOWN_LENGTH if
not knownObtains the length of the MIDI file, expressed in microseconds. |
| public Object | Returns: the value of the property with the specified key, ornull
if the property does not existthe key of the desired property key)Obtain the property value specified by the key. |
| public int | Returns: the number of ticks per beat (PPQ) or per frame (SMPTE)Obtains the timing resolution for the MIDI file. |
| public int | |
| public Map | Returns: aMap<String,Object> object containing all properties. If
no properties are recognized, an empty map is returned.Obtain an unmodifiable map of properties. |
| byteLength | back to summary |
|---|---|
| protected int byteLength The length of the MIDI file in bytes. | |
| divisionType | back to summary |
|---|---|
| protected float divisionType The division type of the MIDI file. | |
| microsecondLength | back to summary |
|---|---|
| protected long microsecondLength The duration of the MIDI file in microseconds. | |
| properties | back to summary |
|---|---|
| private HashMap<String, Object> properties The set of properties. | |
| resolution | back to summary |
|---|---|
| protected int resolution The timing resolution of the MIDI file. | |
| type | back to summary |
|---|---|
| protected int type The type of MIDI file. | |
| UNKNOWN_LENGTH | back to summary |
|---|---|
| public static final int UNKNOWN_LENGTH Represents unknown length.
| |
| MidiFileFormat | back to summary |
|---|---|
| public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds) Constructs a
| |
| MidiFileFormat | back to summary |
|---|---|
| public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds, Map<String, Object> properties) Construct a
| |
| getByteLength | back to summary |
|---|---|
| public int getByteLength() Obtains the length of the MIDI file, expressed in 8-bit bytes.
| |
| getDivisionType | back to summary |
|---|---|
| public float getDivisionType() Obtains the timing division type for the MIDI file.
| |
| getMicrosecondLength | back to summary |
|---|---|
| public long getMicrosecondLength() Obtains the length of the MIDI file, expressed in microseconds.
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String key) Obtain the property value specified by the key. The concept of properties
is further explained in the
If the specified property is not defined for a particular file format,
this method returns
| |
| getResolution | back to summary |
|---|---|
| public int getResolution() Obtains the timing resolution for the MIDI file. If the division type is PPQ, the resolution is specified in ticks per beat. For SMPTE timing, the resolution is specified in ticks per frame.
| |
| getType | back to summary |
|---|---|
| public int getType() Obtains the MIDI file type.
| |
| properties | back to summary |
|---|---|
| public Map Obtain an unmodifiable map of properties. The concept of properties is
further explained in the
| |