1.0.2 • Published 2 years ago

lumidi v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

lumidi

Parser

Convert MIDI-data to JSON.

This library converts data in Standard Midi File-format (SMF, ".mid") into a JSON object

It adheres to the the MIDI Associations' SMF specification which you can find on https://midi.org/

Some features are not implemented, for example sysex events / multi packet events.

Usage

  • Parse file asynchronously
async function parseMIDIFile() {
  const parsedFile = await MIDIParser.parse("test.mid");
}
  • Parse from buffer synchronously
  const midiData = fs.readFileSync("test.mid"); // read a midi-file into buffer

  const parsedData = MIDIParser.parse(midiData)

Converter

Convert JSON data into a MIDI file

Format MidiFile

Usage

const myMidiFile: MidiFile = {
  type: MIDIFileFormat.MultipleTracksSync,
  ticksPerQuarter: 480,
  tracks: [
    // Tracks contain event objects
    [{ type: "TrackEnd", ticks: 0 }]
  ]
}

const buf: Buffer = generateFile(myMidiFile); writeFileSync("myMidiFile.mid", buf);

Most MIDI events are supported 
- [ChannelEvents](../wiki/Exports#channelevent)
- [MetaEvents](../wiki/Exports#metaevent)
  - [TextEvents](../wiki/Exports#textevent)
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago