Table of Contents

Class MidiFile

Namespace
NAudio.Midi
Assembly
NAudio.Midi.dll

Class able to read a MIDI file

public class MidiFile
Inheritance
MidiFile
Inherited Members

Constructors

MidiFile(Stream, bool)

Opens a MIDI file stream for reading

public MidiFile(Stream inputStream, bool strictChecking)

Parameters

inputStream Stream

The input stream containing a MIDI file

strictChecking bool

If true will error on non-paired note events

MidiFile(string)

Opens a MIDI file for reading

public MidiFile(string filename)

Parameters

filename string

Name of MIDI file

MidiFile(string, bool)

Opens a MIDI file for reading

public MidiFile(string filename, bool strictChecking)

Parameters

filename string

Name of MIDI file

strictChecking bool

If true will error on non-paired note events

Properties

DeltaTicksPerQuarterNote

Delta Ticks Per Quarter Note

public int DeltaTicksPerQuarterNote { get; }

Property Value

int

Events

The collection of events in this MIDI file

public MidiEventCollection Events { get; }

Property Value

MidiEventCollection

FileFormat

MIDI File format

public int FileFormat { get; }

Property Value

int

Tracks

Number of tracks in this MIDI file

public int Tracks { get; }

Property Value

int

Methods

Export(Stream, MidiEventCollection)

Exports a MIDI event collection to a stream.

public static void Export(Stream stream, MidiEventCollection events)

Parameters

stream Stream

Stream to write the MIDI data to. Must be writable and seekable — track chunk sizes are patched in after each track is written. The stream is left open on completion; the caller is responsible for disposing it.

events MidiEventCollection

Events to export.

Export(string, MidiEventCollection)

Exports a MIDI file

public static void Export(string filename, MidiEventCollection events)

Parameters

filename string

Filename to export to

events MidiEventCollection

Events to export

ToString()

Describes the MIDI file

public override string ToString()

Returns

string

A string describing the MIDI file and its events