json-midi-encoder3.2.4 • Public • Published
This module encodes a JSON representation of MIDI data into a binary MIDI file.
By using this module it is possible to encode a JSON representation of a MIDI file into its binary counterpart. That JSON representation can either be created from scratch or produced by parsing an existing file with the midi-json-parser.
This module is distributed as package on npm. It can be installed by running the following command:
npm install json-midi-encoder
The only exported function is called
encode(). It expects to receive a JSON representation as its
only parameter. It returns a Promise which hopefully resolves with an ArrayBuffer containing the
binary MIDI file. Here is a little example.
;const json =division: 480format: 1tracks:delta: 0trackName: 'example'// ... there are probably more events ...delta: 0endOfTrack: true// ... maybe there are more tracks ...;;
To see what kind of events this module can handle, you may want to have a look at the JSON files used to test this module. There is also a TypeScript interface which describes the JSON representation.