MidiWriterJS :JavaScript 多轨 MIDI 文件生成库
MidiWriterJS 是一个 JavaScript 库,提供一个 API,可以从代码中生成表达式多轨 MIDI 文件。
安装:
npm install midi-writer-js
代码示例:
// Start with a new track var track = new MidiWriter.Track(); // Define an instrument (optional): track.addEvent(new MidiWriter.ProgramChangeEvent({instrument : 1})); // Add some notes: var note = new MidiWriter.NoteEvent({pitch:['C4', 'D4', 'E4'], duration: '4'}); track.addEvent(note); // Generate a data URI var write = new MidiWriter.Writer([track]); console.log(write.dataUri());
发表回复