grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.
MIT License
547 stars 58 forks source link

Document MidiWriter.saveMIDI #54

Closed leegee closed 5 years ago

leegee commented 5 years ago

Please document MidiWriter's saveMIDI method - I only found it through StackOverflow.

PedroAlvesV commented 5 years ago

Well... http://grimmdude.com/MidiWriterJS/docs/Writer.html#saveMIDI

Em seg, 29 de abr de 2019 às 07:54, Lee Goddard notifications@github.com escreveu:

Please document MidiWriter's saveMIDI method - I only found it through StackOverflow https://stackoverflow.com/questions/19192590/javascript-how-to-export-a-midi-file .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/grimmdude/MidiWriterJS/issues/54, or mute the thread https://github.com/notifications/unsubscribe-auth/ADY45IK2UBGBMSN4KZZSGETPS3HUXANCNFSM4HJCIGPQ .

leegee commented 5 years ago

Didn't find that doc. Guess I thought the readme was exhaustive.

Thanks!

On Mon, Apr 29, 2019, 23:54 Pedro Alves Valentim notifications@github.com wrote:

Well... http://grimmdude.com/MidiWriterJS/docs/Writer.html#saveMIDI

Em seg, 29 de abr de 2019 às 07:54, Lee Goddard notifications@github.com escreveu:

Please document MidiWriter's saveMIDI method - I only found it through StackOverflow < https://stackoverflow.com/questions/19192590/javascript-how-to-export-a-midi-file

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/grimmdude/MidiWriterJS/issues/54, or mute the thread < https://github.com/notifications/unsubscribe-auth/ADY45IK2UBGBMSN4KZZSGETPS3HUXANCNFSM4HJCIGPQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/grimmdude/MidiWriterJS/issues/54#issuecomment-487757775, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD5GMCV5JJFJQE2U2ZN6ZLPS5U7VANCNFSM4HJCIGPQ .

grimmdude commented 5 years ago

Yep you can find it documented there. Though, I sorta feel like it's better to just handle the save logic separately since you may want to use different options, etc. Something like this:

const fs = require('fs');
const write = new MidiWriter.Writer(track);
const buffer = new Buffer(write.buildFile());
fs.writeFile('my-midi-file.mid', buffer, function (err) {
    if(err) throw err;
});
leegee commented 5 years ago

In any case, your module saved me a lot of time and allowed me to get on with the music -- many thanks!

On Tue, Apr 30, 2019, 04:13 Garrett Grimm notifications@github.com wrote:

Yep you can find it documented there. Though, I sorta feel like it's better to just handle the save logic separately since you may want to use different options, etc. Something like this:

const fs = require('fs');const write = new MidiWriter.Writer(track);const buffer = new Buffer(write.buildFile());fs.writeFile('my-midi-file.mid', buffer, function (err) { if(err) throw err; });

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/grimmdude/MidiWriterJS/issues/54#issuecomment-487802669, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD5GMGJIY4RF77G5BGB23TPS6TLPANCNFSM4HJCIGPQ .