{"id":13433630,"url":"https://github.com/grimmdude/MidiPlayerJS","last_synced_at":"2025-03-17T13:30:38.089Z","repository":{"id":11615328,"uuid":"68489554","full_name":"grimmdude/MidiPlayerJS","owner":"grimmdude","description":"♬ MIDI parser \u0026 player engine for browser or Node.  As a parser converts MIDI events into JSON.  Works well with single or multitrack MIDI files.","archived":false,"fork":false,"pushed_at":"2024-02-21T08:17:41.000Z","size":3972,"stargazers_count":347,"open_issues_count":23,"forks_count":50,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-04-14T11:56:11.718Z","etag":null,"topics":["audio","es6","javascript-library","midi","midi-player"],"latest_commit_sha":null,"homepage":"https://grimmdude.com/MidiPlayerJS/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grimmdude.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-09-18T02:10:18.000Z","updated_at":"2024-04-19T19:54:00.346Z","dependencies_parsed_at":"2023-01-13T21:00:48.443Z","dependency_job_id":"275cbfdd-d200-43f6-bfe5-bca144241091","html_url":"https://github.com/grimmdude/MidiPlayerJS","commit_stats":{"total_commits":193,"total_committers":9,"mean_commits":"21.444444444444443","dds":0.5854922279792747,"last_synced_commit":"b15c24d3af1052f67644f341c72fe78534d9bd50"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grimmdude%2FMidiPlayerJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grimmdude%2FMidiPlayerJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grimmdude%2FMidiPlayerJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grimmdude%2FMidiPlayerJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grimmdude","download_url":"https://codeload.github.com/grimmdude/MidiPlayerJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243726424,"owners_count":20337807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","es6","javascript-library","midi","midi-player"],"created_at":"2024-07-31T02:01:31.332Z","updated_at":"2025-03-17T13:30:37.301Z","avatar_url":"https://github.com/grimmdude.png","language":"JavaScript","funding_links":[],"categories":["Libraries: Web MIDI API","JavaScript"],"sub_categories":["Web MIDI API"],"readme":"# \u0026#9836; MidiPlayerJS\n[![npm version](https://badge.fury.io/js/midi-player-js.svg)](https://badge.fury.io/js/midi-player-js)\n[![Build Status](https://travis-ci.org/grimmdude/MidiPlayerJS.svg?branch=master)](https://travis-ci.org/grimmdude/MidiPlayerJS)\n\nMidiPlayerJS is a JavaScript library which reads standard MIDI files and emits JSON events in real time.  This player does not generate any audio, but by attaching a handler to the event emitter you can trigger any code you like which could play audio, control visualizations, feed into a MIDI interface, etc.\n\n## Demos\n* [Neopixel Music](https://github.com/robertvorthman/neopixel-music) by robertvorthman @robertvorthman\n* [Autocomposer](https://github.com/rjsalvadorr/autocomposer-js) by RJ Salvador @rjsalvadorr\n* [Simple Browser Player](http://grimmdude.com/MidiPlayerJS/) by Garrett Grimm @grimmdude\n* [Orchestra](https://lexcast.github.io/orchestra/) by Daniel Alejandro Cast @lexcast\n\n## Getting Started\nUsing MidiWriterJS is pretty simple.  Create a new player by instantiating `MidiPlayer.Player` with an event handler to be called for every MIDI event.  Then you can load and play a MIDI file.\n\n```js\nimport MidiPlayer from 'midi-player-js';\n\n// Initialize player and register event handler\nconst Player = new MidiPlayer.Player(function(event) {\n\tconsole.log(event);\n});\n\n// Load a MIDI file\nPlayer.loadFile('./test.mid');\nPlayer.play();\n```\n## Player Events\nThere are a handful of events on the `Player` object which you can subscribe to using the `Player.on()` method.  Some events pass data as the first argument of the callback as described below:\n\n```js\nPlayer.on('fileLoaded', function() {\n    // Do something when file is loaded\n});\n\nPlayer.on('playing', function(currentTick) {\n    // Do something while player is playing\n    // (this is repeatedly triggered within the play loop)\n});\n\nPlayer.on('midiEvent', function(event) {\n    // Do something when a MIDI event is fired.\n    // (this is the same as passing a function to MidiPlayer.Player() when instantiating.\n});\n\nPlayer.on('endOfFile', function() {\n    // Do something when end of the file has been reached.\n});\n```\n\nNote that because of a common practice called \"running status\" many MIDI files may use `Note on` events with `0` velocity in place of `Note off` events.\n\n## Full API Documentation\n[http://grimmdude.com/MidiPlayerJS/docs/](http://grimmdude.com/MidiPlayerJS/docs/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrimmdude%2FMidiPlayerJS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrimmdude%2FMidiPlayerJS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrimmdude%2FMidiPlayerJS/lists"}