Created
April 7, 2017 20:51
-
-
Save runemadsen/e047c65e60f9b05143abcc735ce76818 to your computer and use it in GitHub Desktop.
midi file download
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var midi = MidiConvert.create() | |
midi.track() | |
.patch(32) | |
.note(60, 0, 2) | |
.note(63, 1, 2) | |
.note(60, 2, 2); | |
var data = 'data:audio/midi;base64,' + btoa(midi.encode()) | |
var element = document.createElement('a'); | |
element.setAttribute('href', data); | |
element.setAttribute('download', 'miditest.midi'); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); | |
document.body.removeChild(element); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment