Skip to main content

alphaTab.midi.MidiFile

Represents a midi file with a single track that can be played via AlphaSynth

 class MidiFile

Properties​

division​

Gets or sets the division per quarter notes.

division: number;

events​

Gets a list of midi events sorted by time.

readonly events: MidiEvent[];

format​

Gets or sets the midi file format to use.

tickShift​

An indicator by how many midi-ticks the song contents are shifted. Grace beats at start might require a shift for the first beat to start at 0. This information can be used to translate back the player time axis to the music notation.

tickShift: number;

tracks​

Gets a list of midi tracks.

readonly tracks: MidiTrack[];

Methods​

addEvent​

Adds the given midi event a the correct time position into the file.

addEvent(e: MidiEvent): void
ParameterSummary
eAll

(no description)

toBinary​

Writes the midi file into a binary format.

toBinary(): Uint8Array

Returns​

The binary midi file.

writeTo​

Writes the midi file as binary into the given stream.

writeTo(s: IWriteable): void
ParameterSummary
sAll

(no description)

Returns​

The stream to write to.

writeVariableInt​

(no description)

static writeVariableInt(s: IWriteable, value: number): void
ParameterSummary
sAll

(no description)

valueAll

(no description)