npm install https://github.com/celsasser/midi-file-io
Forked from midi-file-parser. Special thanks to the authors.
Added write functionality, tests and made small additions/revisions to the read functionity. Probably not as portable as it was. File IO has dependencies on NodeJS's fs
. Feel free to fork it and pull it out if this gets in your way.
Functionality is broken up into read and write. Each of these are broken up into a file operation and a buffer operation:
parseMidiBuffer
- parses the binary MIDI buffer into a MidiIoSongparseMidiFile
- parses the MIDI file at the specified path into a MidiIoSongwriteMidiToBuffer
- writes the specified MidiIoSong object to a returnedBuffer
.writeMidiToFile
- writes the specified MidiIoSong object to the specified path.
const midiFileIO = require('midi-file-parser');
const buffer = require('fs').readFileSync('rachnananov.mid', 'binary')
const parsed = parseMidiBuffer(buffer);
const midiFileIO = require('midi-file-parser');
const parsed = parseMidiFile('rachnananov.mid');
const midiFileIO = require('midi-file-parser');
const parsed = parseMidiFile('rachnananov.mid');
const buffer = writeMidiToBuffer(parsed);
const midiFileIO = require('midi-file-parser');
const parsed = parseMidiFile('rachnananov.mid');
const buffer = writeMidiToFile(parsed, 'rachnananov-copy.mid');