-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for writing MIDI files #9
Comments
I actually didn't document the MIDIFile write functions since i think it is still experimental. Feel free to document it, i'll accept any PR doing so. |
Here's an example of transforming a MIDI file, simplified from midiflip: var MIDIFile = require("midifile");
var MIDIEvents = require("midievents");
var midiFile = new MIDIFile(inputArrayBuffer);
for(var track_index = 0; track_index < midiFile.tracks.length; track_index++){
var events = midiFile.getTrackEvents(track_index);
for(var i=0; i<events.length; i++){
var event = events[i];
if(event.type === MIDIEvents.EVENT_MIDI){
if(event.subtype === MIDIEvents.EVENT_MIDI_NOTE_OFF || event.subtype === MIDIEvents.EVENT_MIDI_NOTE_ON){
event.param1 = 127 - event.param1;
}
}
}
midiFile.setTrackEvents(track_index, events);
}
var outputArrayBuffer = midiFile.getContent(); There should be documentation for individual methods though. |
@1j01 i like midiflip, a very good use of midifile ;). I'll try it soon. On documentation, i know, shame on me but i do not ever use midifile, just wrote it cause i wanted to know if i could. But the good news is that i merge PRs or even add rights to people wanted to get involved on it ;). That said, the MIDI standards aren't changing that often and except documentation/tests/refactoring i don't think there is that much work. I'll probably make an ES6 refactoring sometime and add JSDocs but can't tell when. |
Just a note: if you want to make changes to
|
Thank you for putting MIDIFile together! Is there any documentation on how to write MIDI files? The Readme says the project can write files, but the documentation only includes methods for reading them.
The text was updated successfully, but these errors were encountered: