Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
midi [2023/02/15 20:43] – [Playing a midi on a webpage!] melon | midi [2023/04/06 15:52] (current) – [Playing a midi on a webpage!] melon | ||
---|---|---|---|
Line 11: | Line 11: | ||
===== Playing a midi on a webpage! ===== | ===== Playing a midi on a webpage! ===== | ||
- | Often you'll want to convert the midi to a compressed mp3 using your preferred | + | ==== Melon' |
+ | |||
+ | Melon created a little premade scrip that played midi' | ||
+ | |||
+ | ==== Midi JS ==== | ||
+ | |||
+ | Often you'll want to convert the midi to a compressed mp3 using your preferred | ||
You can also embed midis directly into a browser using [[https:// | You can also embed midis directly into a browser using [[https:// | ||
- | **Include the MIDIjs script on your web page**. You can download the script to your site or use this hotlink: | + | **Include the MIDIjs script on your web page (put this in the head)**. You can download the script to your site or use this hotlink: |
< | < | ||
<script src=" | <script src=" | ||
</ | </ | ||
- | **Load a MIDI file to play**. You can use the MIDIjs.loadFile() function to load a MIDI file from a URL. For example, | + | |
- | < | + | ==== Now you can play midis on your site using these JavaScript commands! ==== |
- | MIDIjs.loadFile(" | + | |
- | </ | + | |
**Play or stop the MIDI file**. You can use the MIDIjs.play() and MIDIjs.stop() functions to play or stop the MIDI file. For example, you can use this code to play the MIDI file: | **Play or stop the MIDI file**. You can use the MIDIjs.play() and MIDIjs.stop() functions to play or stop the MIDI file. For example, you can use this code to play the MIDI file: | ||
< | < | ||
- | MIDIjs.play(); | + | MIDIjs.play(" |
</ | </ | ||
And this code to stop the MIDI file: | And this code to stop the MIDI file: |