Skip to content


Subversion checkout URL

You can clone with
Download ZIP
JavaScript ActionScript Ruby
Branch: master
Failed to load latest commit information.
LICENSE initial commit
README update twitter handle
Rakefile refactor replayer so that we can generate specified durations of audio
audio.js createJavaScriptNode --> createScriptProcessor
da.swf refactor replayer so that we can generate specified durations of audio initial commit
index.html check for mimetype audio/midi, not audio/mid
midifile.js added a way to read a signed int to correctly read the key signature …
minute_waltz.mid initial commit
rachmaninov3.mid initial commit
replayer.js Don't die on noteOff events that have had no corresponding noteOn
sandbox.html Added midiToFrequency(), correct A440hz to Midi number 69 instead of 57
stream.js fixed tab vs. spaces issue with code change
synth.js tab fixing


jasmid - A Javascript MIDI file reader and synthesiser

Originally presented at BarCamp London 8, 13-14 November 2010

Open index.html in browser. Turn up volume. Click on link.

Sound output is via one of the following mechanisms, according to what your
browser supports:
* Mozilla Audio Data API <>
* Web Audio API
* a Flash fallback originally taken from dynamicaudio.js by Ben Firshman
    <> and hacked around by me.

The code:
stream.js - helper library for reading a string as a stream of typed data
midifile.js - parses the MIDI file format into a header and a list of tracks,
    each consisting of a list of event objects
replayer.js - steps over the data structure generated by midifile.js and calls
    the appropriate operations on the synthesiser
synth.js - audio synthesiser; generates waveforms according to tweakable
audio.js - passes the generated waveform to either the Audio Data API or the
    Flash fallback widget (da.swf)

* The only event types supported by replayer.js are note on, note off, tempo
    change and program change
* There are currently only two instrument presets defined in synth.js - one for
    strings and a 'piano' one for everything else - and neither of them are
    particularly good (just a single volume-modulated sine wave).

Matt Westcott <> - @gasmanic -
Something went wrong with that request. Please try again.