Standard MIDI File (SMF) reader and writer.
Supports Format 0, 1, and 2 MIDI files with full meta message support.
Data structures
- File:
{:midi_file, type, division, tracks} - Track:
{:track, events} - Event:
{name, delta_time, values}where values is a list or a string
Examples
iex> midi = ExMidi.MidiFile.read("song.mid")
iex> for track <- ExMidi.MidiFile.tracks(midi) do
...> for event <- track do
...> IO.inspect(event)
...> end
...> endInspired by mido's MidiFile with play/1 support:
iex> midi = ExMidi.MidiFile.read("song.mid")
iex> for msg <- ExMidi.MidiFile.play(midi) do
...> IO.inspect(msg)
...> end
Summary
Functions
Return the time division of a MIDI file.
Return the format type (0, 1, or 2) of a MIDI file.
Iterate through all messages in the file, merging tracks and yielding
messages with absolute time. Similar to mido's MidiFile.play().
Read a MIDI file from the given path.
Return the length of the longest track in ticks.
Return the tracks of a MIDI file.
Write a MIDI file to the given path.
Functions
Return the time division of a MIDI file.
Return the format type (0, 1, or 2) of a MIDI file.
Iterate through all messages in the file, merging tracks and yielding
messages with absolute time. Similar to mido's MidiFile.play().
Yields {:midi, payload} tuples.
Read a MIDI file from the given path.
Return the length of the longest track in ticks.
Return the tracks of a MIDI file.
Write a MIDI file to the given path.