Includes a library to program synesthesia into your app for memory recognition or for creating trippy effects. Convert soundfonts for Guitar, Bass, Drums, ect. into code that can be read by the browser.
 
 
Go to file
Denis Knauf 69304a9773 forgotten stopallNotes, stopAllNotesAllChannels added 2013-06-07 00:08:20 +02:00
build grunt build 2013-01-25 15:33:58 -08:00
css add USE_JAZZMIDI variable to enable experimental Web MIDI API, add utf8 meta tags to demos 2013-01-28 12:27:53 -08:00
images let there be midi 2012-02-15 20:46:03 -08:00
inc Merge branch 'master' of https://github.com/mudcube/MIDI.js 2013-02-19 12:22:28 -08:00
js forgotten stopallNotes, stopAllNotesAllChannels added 2013-06-07 00:08:20 +02:00
soundfont use XHR or SCRIPT tag to loadPlugin, XHR has benefit of OnProgress event, whereas SCRIPT has benefit of loading from file:// 2013-01-18 23:18:41 -08:00
soundfont-generator fix ruby build path 2013-01-23 00:39:14 -08:00
.gitignore Update gruntfile to v0.4 2013-02-28 15:51:19 -08:00
Gruntfile.js Update gruntfile to v0.4 2013-02-28 15:51:19 -08:00
LICENSE-MIT.txt update license year 2013-01-25 00:17:34 -08:00
README.md Removed Ear Builder link 2013-04-09 22:09:39 +03:00
demo-Basic.html removed WebMIDIAPI.js from demos as it's been getting in the way with older browsers (and is anyone else using this?) 2013-04-01 16:09:29 -07:00
demo-MIDIPlayer.html removed WebMIDIAPI.js from demos as it's been getting in the way with older browsers (and is anyone else using this?) 2013-04-01 16:09:29 -07:00
demo-MultipleInstruments.html removed WebMIDIAPI.js from demos as it's been getting in the way with older browsers (and is anyone else using this?) 2013-04-01 16:09:29 -07:00
demo-WhitneyMusicBox.html removed WebMIDIAPI.js from demos as it's been getting in the way with older browsers (and is anyone else using this?) 2013-04-01 16:09:29 -07:00
package.json Update gruntfile to v0.4 2013-02-28 15:51:19 -08:00

README.md

CODE EXAMPLES (from the repo)

  • ./demo-Basic.html - the most basic implementation.
  • ./demo-MIDIPlayer.html - how to parse MIDI files, and interact with the data stream.
  • ./demo-MultipleInstruments.html - synth drum and piano playing together
  • ./demo-WhitneyMusicBox.html - a audio/visual experiment by Jim Bumgardner

DEMOS


// interface to download soundfont, then execute callback;
MIDI.loadPlugin(callback);
// simple example to get started;
MIDI.loadPlugin({
    instrument: "acoustic_grand_piano", // or the instrument code 1 (aka the default)
    instruments: [ "acoustic_grand_piano", "acoustic_guitar_nylon" ], // or multiple instruments
    callback: function() { }
});
MIDI.noteOn(channel, note, velocity, delay);
MIDI.noteOff(channel, note, delay);
MIDI.chordOn(channel, chord, velocity, delay);
MIDI.chordOff(channel, chord, delay);
MIDI.keyToNote = object; // A0 => 21
MIDI.noteToKey = object; // 21 => A0
MIDI.Player.currentTime = integer; // time we are at now within the song.
MIDI.Player.endTime = integer; // time when song ends.
MIDI.Player.playing = boolean; // are we playing? yes or no.
MIDI.Player.loadFile(file, callback); // load .MIDI from base64 or binary XML request.
MIDI.Player.start(); // start the MIDI track (you can put this in the loadFile callback)
MIDI.Player.resume(); // resume the MIDI track from pause.
MIDI.Player.pause(); // pause the MIDI track.
MIDI.Player.stop(); // stops all audio being played, and resets currentTime to 0.

// Callback whenever a note is played;
MIDI.Player.removeListener(); // removes current listener.
MIDI.Player.addListener(function(data) { // set it to your own function!
    var now = data.now; // where we are now
    var end = data.end; // time when song ends
    var channel = data.channel; // channel note is playing on
    var message = data.message; // 128 is noteOff, 144 is noteOn
    var note = data.note; // the note
    var velocity = data.velocity; // the velocity of the note
    // then do whatever you want with the information!
});

// Smooth animation, interpolates between onMidiEvent calls;
MIDI.Player.clearAnimation(); // clears current animation.
MIDI.Player.setAnimation(function(data) {
    var now = data.now; // where we are now
    var end = data.end; // time when song ends
    var events = data.events; // all the notes currently being processed
    // then do what you want with the information!
});
  • Color.js: Color conversions, music isnt complete without!
Color.Space(0xff0000, "HEX>RGB>HSL");
DOMLoader.script.add(src, callback);
DOMLoader.sendRequest(src, callback);

Many thanks to the authors of these libraries;

* Web MIDI API: W3C proposal by Jussi Kalliokoski & Chris Wilson * Web Audio API: W3C proposal by Chris Rogers * <audio>: HTML5 specs * Flash package: SoundManager2 by Scott Schiller * jasmid: Reads MIDI file byte-code, and translats into a Javascript array. * base642binary.js: Cleans up XML base64-requests for Web Audio API.