{"id":20796405,"url":"https://github.com/jazz-soft/web-midi-test","last_synced_at":"2025-05-06T07:53:34.437Z","repository":{"id":96156502,"uuid":"186349830","full_name":"jazz-soft/web-midi-test","owner":"jazz-soft","description":"Fake Web MIDI API for testing Web MIDI applications","archived":false,"fork":false,"pushed_at":"2025-04-03T23:35:44.000Z","size":78,"stargazers_count":8,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-04T09:46:28.553Z","etag":null,"topics":["midi","test","web-midi","web-midi-api","webmidi","webmidiapi"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jazz-soft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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,"publiccode":null,"codemeta":null},"funding":{"github":"jazz-soft","custom":"https://paypal.me/jazzsoft"}},"created_at":"2019-05-13T05:15:58.000Z","updated_at":"2025-04-03T23:35:47.000Z","dependencies_parsed_at":"2024-04-08T09:28:33.836Z","dependency_job_id":"6c1e7c2a-9122-4f9d-9e29-d9d7b0f3ae9c","html_url":"https://github.com/jazz-soft/web-midi-test","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Fweb-midi-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Fweb-midi-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Fweb-midi-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazz-soft%2Fweb-midi-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jazz-soft","download_url":"https://codeload.github.com/jazz-soft/web-midi-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252643487,"owners_count":21781520,"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":["midi","test","web-midi","web-midi-api","webmidi","webmidiapi"],"created_at":"2024-11-17T16:27:06.103Z","updated_at":"2025-05-06T07:53:34.421Z","avatar_url":"https://github.com/jazz-soft.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jazz-soft","https://paypal.me/jazzsoft"],"categories":[],"sub_categories":[],"readme":"# web-midi-test\n\n[![npm](https://img.shields.io/npm/v/web-midi-test.svg)](https://www.npmjs.com/package/web-midi-test)\n[![npm](https://img.shields.io/npm/dt/web-midi-test.svg)](https://www.npmjs.com/package/web-midi-test)\n[![build](https://github.com/jazz-soft/web-midi-test/actions/workflows/build.yml/badge.svg)](https://github.com/jazz-soft/web-midi-test/actions)\n[![Coverage Status](https://coveralls.io/repos/github/jazz-soft/web-midi-test/badge.svg?branch=master)](https://coveralls.io/github/jazz-soft/web-midi-test?branch=master)\n[![Try web-midi-test on RunKit](https://badge.runkitcdn.com/web-midi-test.svg)](https://npm.runkit.com/web-midi-test)\n\n## Fake Web MIDI API for testing Web MIDI applications\n\nSee also: [**Web MIDI API**](https://webaudio.github.io/web-midi-api/)\n\nSee also: [**midi-test**](https://github.com/jazz-soft/midi-test),\n[**jazz-midi-headless**](https://github.com/jazz-soft/jazz-midi-headless),\n[**test-midi-files**](https://github.com/jazz-soft/test-midi-files)\n\nInstall: `npm install web-midi-test --save-dev`\n\n## Usage\n#### Node.js\n\n```js\nvar WMT = require('web-midi-test');\nnavigator.requestMIDIAccess = WMT.requestMIDIAccess; // Node 22 and above, or\nvar navigator = { requestMIDIAccess: WMT.requestMIDIAccess }; // older versions\nvar performance = { now: WMT.now }; // if required...\n// ...\n```\n\n#### HTML\n\n```html\n\u003cscript src=\"node_modules/web-midi-test/wmt.js\"\u003e\u003c/script\u003e\n// this will add an object named WMT into the global scope\n// ...\nif (typeof navigator.requestMIDIAccess == 'undefined') {\n  navigator.requestMIDIAccess = WMT.requestMIDIAccess;\n}\n// ...\n```\n\n#### TypeScript\n`tsc myscript.ts --lib es2015,dom`\n\n```ts\nimport * as WMT from 'web-midi-test';\n// ...\n```\n\n#### With [JSDOM](https://github.com/jazz-soft/web-midi-test/tree/master/demo-jsdom)  \n#### With [Zombie.js](https://github.com/jazz-soft/web-midi-test/tree/master/demo-zombie)\n#### With [Puppeteer](https://github.com/jazz-soft/web-midi-test/tree/master/demo-puppeteer)\n#### With [Playwright](https://github.com/jazz-soft/web-midi-test/tree/master/demo-playwright)\n\n## API\n#### MIDI access\n\n```js\nfunction onSuccess() { console.log('Success!'); }\nfunction onFail() { console.log('Fail!'); }\n\n// normal scenario\nWMT.requestMIDIAccess().then(onSuccess, onFail); // Success!\nWMT.requestMIDIAccess({ sysex: true }).then(onSuccess, onFail); // Success!\n\n// no sysex permission scenario\nWMT.sysex = false;\nWMT.requestMIDIAccess().then(onSuccess, onFail); // Success!\nWMT.requestMIDIAccess({ sysex: true }).then(onSuccess, onFail); // Fail!\n\n// no midi permission scenario\nWMT.midi = false;\nWMT.requestMIDIAccess().then(onSuccess, onFail); // Fail!\n```\n\n#### MIDI Source (Virtual MIDI-In)\n\n```js\nvar port = new WMT.MidiSrc('VIRTUAL MIDI-In');\nport.connect();\nport.emit([0x90, 0x40, 0x7f]);\n//...\nport.busy = true;  // \"another application\" captured the port\n// Web MIDI can see the port, but can not connect to it\nport.busy = false; // \"another application\" released the port\n//...\nport.disconnect();\n```\n\n#### MIDI Destination (Virtual MIDI-Out)\n\n```js\nvar port = new WMT.MidiDst('VIRTUAL MIDI-Out');\nport.receive = function(msg) { console.log('received:', msg); };\nport.connect();\n//...\nport.busy = true;  // \"another application\" captured the port\n// Web MIDI can see the port, but can not connect to it\nport.busy = false; // \"another application\" released the port\n//...\nport.disconnect();\n```\n\n## Thanks for your support!\n[![Stargazers for @jazz-soft/web-midi-test](https://reporoster.com/stars/jazz-soft/web-midi-test)](https://github.com/jazz-soft/web-midi-test/stargazers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjazz-soft%2Fweb-midi-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjazz-soft%2Fweb-midi-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjazz-soft%2Fweb-midi-test/lists"}