All Projects → colxi → Midi Parser Js

colxi / Midi Parser Js

Licence: gpl-3.0
JSON Human readable MIDI sequences. Read from ArrayBuffers, Base64 encoded strings, or FileInput Element in Browsers.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Midi Parser Js

Daigassou
Transfer midi file to keyboard events in FFXIV bard performance solo and multiplayer
Stars: ✭ 69 (-41.53%)
Mutual labels:  midi
Hellodrum Arduino Library
This is a library for making E-Drum with arduino.
Stars: ✭ 95 (-19.49%)
Mutual labels:  midi
Wad
Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
Stars: ✭ 1,540 (+1205.08%)
Mutual labels:  midi
Gb2midi
Tools for converting Garageband files to MIDI files
Stars: ✭ 74 (-37.29%)
Mutual labels:  midi
Audiokitsynthone
AudioKit Synth One: Open-Source iOS Synthesizer App
Stars: ✭ 1,258 (+966.1%)
Mutual labels:  midi
Webmidikit
Simplest MIDI Swift library
Stars: ✭ 100 (-15.25%)
Mutual labels:  midi
Abcjs
javascript for rendering abc music notation
Stars: ✭ 1,141 (+866.95%)
Mutual labels:  midi
Pimidi
Raspberry Pi RTP MIDI
Stars: ✭ 112 (-5.08%)
Mutual labels:  midi
Ble Midi For Android
MIDI over Bluetooth LE driver for Android 4.3 or later
Stars: ✭ 90 (-23.73%)
Mutual labels:  midi
Miditimetableview
Customisable and editable time table grid for showing midi or audio related data with a measure.
Stars: ✭ 104 (-11.86%)
Mutual labels:  midi
Midisequencer
MIDI Sequencer that sends MIDI events to other apps.
Stars: ✭ 75 (-36.44%)
Mutual labels:  midi
Minibae
The platform-neutral Beatnik Audio Engine, Mini Edition (miniBAE) is an exceptionally mature, well-rounded, and reliable computer music and sound system specially customized for small-footprint and embedded applications.
Stars: ✭ 82 (-30.51%)
Mutual labels:  midi
Midi2voice
Singing synthesis from MIDI file
Stars: ✭ 102 (-13.56%)
Mutual labels:  midi
Libremidi
A modern C++ MIDI real-time & file I/O library. Supports Windows, macOS, Linux and WebMIDI.
Stars: ✭ 69 (-41.53%)
Mutual labels:  midi
Radiance
Radiance is video art software for VJs. It supports beat detection, animated GIFs, YouTube video, OpenGL shader effects. It is designed for live performance and runs on Linux and MacOS.
Stars: ✭ 109 (-7.63%)
Mutual labels:  midi
Audiokit
Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS
Stars: ✭ 8,827 (+7380.51%)
Mutual labels:  midi
X32 Behringer
This GIT repo (C language) holds applications and utilities for the Behringer X32 and M32 mixing consoles. Additional details, documentation, implementation examples and apps can be found in my website:
Stars: ✭ 97 (-17.8%)
Mutual labels:  midi
Awesome Midi Sources
A curated list of sites with MIDI files on the Web
Stars: ✭ 118 (+0%)
Mutual labels:  midi
Tensorflow Music Generator
generates music (midi files) using a Tensorflow RNN
Stars: ✭ 111 (-5.93%)
Mutual labels:  midi
Miti
miti is a musical instrument textual interface. Basically, its MIDI, but with human-readable text. 🎵
Stars: ✭ 103 (-12.71%)
Mutual labels:  midi

logo

MidiParser.js

NoDependencies Browser Node

MidiParser is a Javascript Binary MIDI file reader for the browser and Node which converts a MIDI binary data structure to a JSON object, making it much easier to iterate over and interact with.

  • Tiny and dependency free
  • Browser & Node Compatible
  • Supported data input :
    • BASE64 encoded Midi data
    • UINT8 arrayBuffer, obtained when reading or fetching a .mid binary.
    • FileInput Element in the Browser
  • Custom Midi Messages

Example

A simple example parsing a MIDI file in Node ...

let midiParser  = require('midi-parser-js');
let fs = require('fs')

// read a .mid binary (as base64)
fs.readFile('./test.mid', 'base64', function (err,data) {
  // Parse the obtainer base64 string ...
  var midiArray = midiParser.parse(data);
  // done!
  console.log(midiArray);
});

Example in Browser...

<script type="module">
  import MidiParser from 'midi-parser-js'
  // select the INPUT element that will handle
  // the file selection.
  let source = document.getElementById('filereader');
  // provide the File source and a callback function
  MidiParser.parse( source, function(obj){
    console.log(obj);
  });
</script>
<input type="file" id="filereader"/>

If you want to see it in action, you can test it Here

Syntax:

  MidiParser.parse( input [, callback] );

- input : Accepts any of the supported Data Sources : FileInputElement | uint8Array | base64String

- callback : Callback to be executed when data is parsed. Only required when input is a FileInputElement.


Handle Custom messages ( sysEx, non-standard...)

By default, the library ignores the sysEx, and non-standard messages, simply converting their values to integers (when possible). However you can provide a custom hook function to be executed when any non-standard message is found, and process it by your own, returning the resulting value.

MidiParser.customInterpreter = function( msgType, arrayBuffer, metaEventLength){  /* your code */ }

- msgType : Hex value of the message type

- arrayBuffer : Dataview of the midi data. You have to extract your value/s from it, moving the pointer as needed.

- metaEventLength : A length greater than 0 indicates a received message

If you want the default action to be executed, return false

Output JSON anatomy :

The returned JSON object contains all the attributes of the MIDI file (format type, time division, track count... ) as properties. The tracks and the MIDI events related to each track are container inside the track property.

logo

The following JSON object represents a MIDI file with 3 tracks and 4 events in Track 0

outputObject{
....formatType: 0|1|2,  // Midi format type
....timeDivision: (int),  // song tempo (bpm)
....tracks: (int),  // total tracks count
....track: Array[
........[0]: Object{  // TRACK 1!
............event: Array[  // Midi events in track 1
................[0] : Object{  // EVENT 1
....................data: (string),
....................deltaTime: (int),
....................metaType: (int),
....................type: (int)
................},
................[1] : Object{...},  // EVENT 2
................[2] : Object{...}, // EVENT 3
................[3] : Object{...}  // EVENT 4
............]
........},
........[1] : Object{...},  // TRACK 2
........[2] : Object{...}  // TRACK 3
....]
}

If you want to read the data from Event 2 of Track 0 , you should use the following keypath :

outputObject.track[0].event[2].data;

Distribution & Installation :

The following distribution channels are available :

- NPM : Install using the following command :

  $ npm install midi-parser-js -s

- GIT : You can clone the repository :

  $ git clone https://github.com/colxi/midi-parser-js.git

-ZIP : Or download the package in a ZIP file from

GITHUB LATEST PACKAGE RELEASE PAGE

-CDN : Include the latest release of this library in your HTML head using the CDN :

Warning : Not recommended for production enviroments!

<script src="https://colxi.info/midi-parser-js/src/main.js"></script>

Importing

This package is shipped with support to Node CommonJS and ES6 Modules. Use the appropiate method accoordintg to your enviroment.

  // ES6 Module Import : 
  import {MidiParser} from './midi-parser.js'; 

  // CommonJS Node Import :
  let MidiParser = require('midi-parser-js');

Bonus : MIDI File Format Specifications :

MIDI Binary Encoding Specifications in https://github.com/colxi/midi-parser-js/wiki/MIDI-File-Format-Specifications

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].