tekartik / midi.dart

Library for manipulating and sequencing Midi files, tracks, events
BSD 2-Clause "Simplified" License
35 stars 6 forks source link

tekartik_midi.dart

Library for parsing, manipulation Midi files and for sequencing midi event

Build Status

API subject to change

Setup

Note about versioning.

pubspec.yaml:

dependencies:
  tekartik_midi:
    git:
      url: https://github.com/tekartik/midi.dart
      ref: dart3a

Usage example

Creating a midi file

var file = MidiFile();
file.fileFormat = MidiFile.formatMultiTrack;
file.ppq = 240;

var track = MidiTrack();
track.addEvent(0, TimeSigEvent(4, 4));
track.addEvent(0, TempoEvent.bpm(120));
track.addEvent(0, EndOfTrackEvent());
file.addTrack(track);

Parsing a midi file

Uint8List data; // the file binary data

// ... fill the data from a midi file

var midiParser = MidiParser(data);
var parser = FileParser(midiParser);
parser.parseFile();

// Resulting midi file
var file = parser.file;