{"id":16348189,"url":"https://github.com/ben-eb/midify","last_synced_at":"2025-11-10T01:30:21.478Z","repository":{"id":25099790,"uuid":"28520914","full_name":"ben-eb/midify","owner":"ben-eb","description":"Makes working with Web MIDI more palatable.","archived":false,"fork":false,"pushed_at":"2015-05-07T09:48:22.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-18T08:31:04.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ben-eb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-26T20:53:07.000Z","updated_at":"2024-05-24T21:17:22.000Z","dependencies_parsed_at":"2022-08-23T19:01:02.847Z","dependency_job_id":null,"html_url":"https://github.com/ben-eb/midify","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fmidify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fmidify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fmidify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-eb%2Fmidify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ben-eb","download_url":"https://codeload.github.com/ben-eb/midify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239576790,"owners_count":19662114,"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":[],"created_at":"2024-10-11T00:49:48.656Z","updated_at":"2025-11-10T01:30:21.444Z","avatar_url":"https://github.com/ben-eb.png","language":"JavaScript","readme":"# midify [![NPM version](https://badge.fury.io/js/midify.svg)](http://badge.fury.io/js/midify) [![Dependency Status](https://gemnasium.com/ben-eb/midify.svg)](https://gemnasium.com/ben-eb/midify)\n\n\u003e Makes working with Web MIDI more palatable.\n\nInstall via [npm](https://npmjs.org/package/midify):\n\n```\nnpm install midify\n```\n\n## What it does\n\nmidify is a package that combines node's event emitter with the browser's web midi api, to make working with midi messages more palatable. It is supposed to be used in combination with modules that expose input and output objects, so that clients can send events such as `deckA.play.on` (to light up the play button's LED), and to allow consuming modules to listen to events such as `crossfader.change`, which will call back with the value of the crossfader, as an example.\n\n**Note that midify is a work in progress**, and currently only two devices are supported as they are all that I have access to. I'm hoping that those who are working with Web MIDI can help me to build up a library of easily consumable maps, so that we as developers can easily build MIDI applications to run on a wide range of devices, using a common format.\n\nCompatible controllers are:\n\n* [Numark DJ 2 Go](https://github.com/ben-eb/midify-numark-dj2go) (http://www.numark.com/product/dj2go)\n* [Numark MixTrack Pro](https://github.com/ben-eb/midify-numark-mixtrack-pro) (http://www.numark.com/product/mixtrackpro)\n\nIf you've created a map for your controller that is compatible with midify, [please open an issue](https://github.com/ben-eb/midify/issues) and it will be added to the list.\n\n## Example\n\nBundle this code with [browserify](https://github.com/substack/node-browserify). Note that Web MIDI is currently available behind a flag in Chrome, and remains unsupported in other browsers. To enable it in Chrome, go to [chrome://flags](chrome://flags) and ensure that the Web MIDI option is on. As of this writing, MIDI support in Chrome is not quite plug and play capable, so you'll need to shut down Chrome and plug your device in before testing any code.\n\n```js\nvar Midify = require('midify');\nvar mixtrack = require('midify-numark-mixtrack-pro');\n\nnavigator.requestMIDIAccess().then(function(midiAccess) {\n    var midiIn;\n    var midiOut;\n\n    // For brevity, we are just assuming one MIDI device is connected\n    for (var input of midiAccess.inputs.values()) {\n        midiIn = input;\n    }\n\n    for (var output of midiAccess.outputs.values()) {\n        midiOut = output;\n    }\n\n    var midify = new Midify({\n        midiIn: midiIn,\n        midiOut: midiOut,\n        controller: mixtrack\n    });\n\n    midify.on('*', function(event) {\n        console.log('triggered', event, 'event');\n    });\n\n}, function() { console.error('MIDI access unavailable'); });\n```\n\n## API\n\n### var midify = new Midify(options)\n\nConstruct a new midify instance. It takes an options object with three parameters; `midiIn` and `midiOut` should be retrieved from the `midiAccess` object, as per the example above, and the `controller` parameter accepts a module which exposes `inputs` and `outputs` objects.\n\n### midify.getLEDs()\n\nGet an array of all the LED outputs; useful if you need to reset all of the lights on the controller:\n\n```js\nmidify.getLEDs().forEach(function(led) {\n    midify.send(led + '.off');\n});\n```\n\n### midify.send()\n\nSend a message to the controller. See the documentation for your controller to see which messages you can send.\n\n```js\nmidify.send('deckA.play.on');\n```\n\n### midify.on()\n\nmidify just inherits from event emitter, so you can listen to events from your controller:\n\n```js\nmidify.on('masterGain.change', function(value) {\n    console.log('volume changed', value);\n});\n```\n\nAs well as the namespaced events, midify will also emit `*`, so that you can listen to all messages for debugging purposes:\n\n```js\nmidify.on('*', function(event, value) {\n    console.log(event, value);\n});\n```\n\nBoth of these events will also emit the full MIDI message object as the final parameter in the callback function; so to access the raw data you can also do:\n\n```js\nmidify.on('*', function(event, value, raw) {\n    console.log(event, value, raw);\n});\n```\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-eb%2Fmidify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fben-eb%2Fmidify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-eb%2Fmidify/lists"}