Giter Site home page Giter Site logo

midi-player's Introduction

MIDI Player

MIDI Player is a JavaScript player based on Wild Web Midi with a simple jQuery interface. It uses instrument patches from Freepats.

Demo and example use

Try this demo for seeing / hearing it running.

Once included in your page, you only need to do (where song is a Base64 coded midi file):

<script type="text/javascript" src="wildwebmidi.js"></script>
<script type="text/javascript" src="midiplayer.js"></script>
<script type="text/javascript" src="example-song.js"></script>

$( document ).ready(function() {
    $("#player").midiPlayer({
        color: "red",
        onUnpdate: midiUpdate,
        onStop: midiStop,
        width: 250,
        locateFile: function(file) {
          //locate wildwebmidi.data
          return '/path/to/'+file;
        }
    });
    $("#player").midiPlayer.play(song);
});

Remark: you also need to include the wildwebmidi.data file that needs to be retrieved by locateFile option, or accessible from the root of your site if not specified.

The source code of the demo is available here

MIDI instruments

The player uses a piano sound font by default. Other instruments can be used, but only one at a time. For this, you need to replace the wildwebmidi.js and the wildwebmidi.data files with the instrument files you want from the ./intruments files.

For example, for using the church organ, you need to include 019_church_organ.js in your page and have 019_church_organ.data accessible from the root of your site.

Building it

For building the midi-player you need Emscripten installed on your machine.

git clone [email protected]:Mindwerks/wildmidi.git
node make

midi-player's People

Contributors

lpugin avatar agmoyano avatar earboxer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.