midi-json-parser
TypeScript icon, indicating that this package has built-in type declarations

8.1.45 • Public • Published

midi-json-parser

This module is parsing midi files into a human-readable JSON object.

version

This module parses a binary MIDI file and turns it into a JSON representation. This JSON representation can then for example be used to pass it on to the midi-player. It can also be encoded again as a binary MIDI file using the json-midi-encoder.

Usage

This module is available on npm and can be installed by running the following command:

npm install midi-json-parser

Once the module is installed you can use its one and only function as shown in the example below:

import { parseArrayBuffer } from 'midi-json-parser';

// Let's assume there is an ArrayBuffer called arrayBuffer which contains the binary content of a
// MIDI file.

parseArrayBuffer(arrayBuffer).then((json) => {
    // json is the JSON representation of the MIDI file.
});

In case you are comfortable with TypeScript, this is the interface which describes the JSON representation:

interface IMidiFile {
    division: number;

    format: number;

    tracks: TMidiEvent[][];
}

The type TMidiEvent is a union of all possible MIDI events. Here is the complete list of all MIDI events this module can handle:

Acknowledgement

Developing this module wouldn't have been possible without all the great resources out there. The following list tries to mention a few of them:

Readme

Keywords

Package Sidebar

Install

npm i midi-json-parser

Weekly Downloads

408

Version

8.1.45

License

MIT

Unpacked Size

54.4 kB

Total Files

16

Last publish

Collaborators

  • chrisguttandin