MidiWriterJS
TypeScript library for programmatically building and exporting multi-track Standard MIDI files.
| Language | JavaScript |
|---|---|
| Category | MIDI tools |
| License | MIT |
| Platforms | macOS Windows Linux Web |
| Install | npm install midi-writer-js |
| First released | 2016 |
| Maintained | Yes |
| Links | Website · Source |
Strengths
- Writes multi-track SMF with chords, arpeggios, grace notes, pitch bends
- Accepts note names or raw MIDI numbers; full TS types
- Runs in Node and the browser
Limitations
- Write-only: it generates MIDI but does not parse or play it
- VexFlow score integration is still experimental
Best for
Generating downloadable MIDI files from code in Node or the browser.
Minimal example
const MidiWriter = require('midi-writer-js');
const track = new MidiWriter.Track();
track.addEvent(new MidiWriter.NoteEvent({ pitch: ['C4'], duration: '4' }));
new MidiWriter.Writer(track).dataUri();