MidiPlayerJS

repository·master·Indexed 19 days ago

https://github.com/grimmdude/midiplayerjs

A real-time MIDI file parser and player engine for browser or Node (version 2.0.17) that emits JSON events. It is designed to serve as a timing and event engine for audio synthesis, visualizations, or MIDI hardware control, rather than as a standalone audio player.

Tokens
5.5K
Snippets
27
Records
33
Agent score
63%

What's inside midi-player-js

  1. How Modernizr detects features

    master

    Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user's browser. It makes detection results available in two ways:

    1. Global Object: As properties on a global Modernizr object.
    2. HTML Classes: As classes on the <html> element.

    This allows for progressive enhancement by providing granular control over the user experience based on browser capabilities.

  2. Understand the Skeleton project structure

    master

    A standard Skeleton download includes the following file structure, providing a CSS reset, the core framework, and a starting HTML file:

    Skeleton/
    ├── index.html
    ├── css/
    │   ├── normalize.min.css
    │   └── skeleton.css
    └── images/
        └── favicon.ico
    • normalize.min.css: Normalize CSS used as a reset.
    • skeleton.css: The core Skeleton CSS framework.
    • index.html: A sample starting point.
    Skeleton/
    ├── index.html
    ├── css/
    │   ├── normalize.min.css
    │   └── skeleton.css
    └── images/
        └── favicon.ico
  3. How MidiPlayerJS works

    master

    MidiPlayerJS is a JavaScript library that reads standard MIDI files and emits JSON events in real time.

    Important Note: This library does not generate audio. It acts as a parser and event emitter. To hear sound, you must attach a handler to the emitted events that triggers your own audio engine, MIDI interface, or visualization code.

  4. Integrate js-cookie with JBoss 7.1.1

    master

    The servlet implementation in JBoss 7.1.1 may fail to read certain characters correctly (such as [ and ]) even though they are allowed by RFC 6265. To fix this, use a custom converter in JavaScript to re-encode these specific characters.

    // In JavaScript: Custom converter for JBoss 7.1.1
    var JBossCookies = Cookies.withConverter({
        write: function (value) {
            // Encode all characters according to the "encodeURIComponent" spec
            return encodeURIComponent(value)
                // Revert the characters that are unnecessarly encoded but are
                // allowed in a cookie value
                .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent)
                // Encode again the characters that are not allowed in JBoss 7.1.1, like "[" and "]":
                .replace(/[\{\[\]\}]/g, encodeURIComponent);
        }
    });
  5. Install js-cookie

    master

    You can install js-cookie using several methods:

    Direct download

    Download the script and include it in your HTML:

    <script src="/path/to/js.cookie.js"></script>

    Note: Do not link directly to GitHub raw files as they are served with the wrong MIME type.

    Package Managers

    Install via npm or Bower using the name js-cookie.

    Module Loaders

    Supports AMD, CommonJS, and ES6 modules.

  6. Run Bootstrap documentation locally

    master

    The documentation is built with Jekyll and can be served locally by following these steps:

    1. Install Jekyll: Ensure Jekyll (v2.0.x) is installed on your system.
      • Note for Windows users: Follow unofficial guides for Jekyll and ensure Python and Pygments are installed for syntax highlighting.
    2. Serve Docs: Navigate to the /bootstrap directory in your terminal and run the serve command.
    3. Access: Open http://localhost:9001 in your browser.
    # From the /bootstrap directory
    jekyll serve