{"id":21819558,"url":"https://github.com/halvves/webmonome","last_synced_at":"2025-08-09T02:17:14.254Z","repository":{"id":38427186,"uuid":"237284586","full_name":"halvves/webmonome","owner":"halvves","description":"we've moved to sourcehut! this is just a mirror of: https://sr.ht/~merl/webmonome/","archived":false,"fork":false,"pushed_at":"2024-03-05T07:26:51.000Z","size":176,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T02:29:20.780Z","etag":null,"topics":["grid","monome","music","serialosc","webusb"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/webmonome/v/alpha","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/halvves.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-01-30T19:04:03.000Z","updated_at":"2023-05-18T19:13:32.000Z","dependencies_parsed_at":"2025-04-15T11:01:40.785Z","dependency_job_id":null,"html_url":"https://github.com/halvves/webmonome","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/halvves/webmonome","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halvves%2Fwebmonome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halvves%2Fwebmonome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halvves%2Fwebmonome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halvves%2Fwebmonome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halvves","download_url":"https://codeload.github.com/halvves/webmonome/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halvves%2Fwebmonome/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269518753,"owners_count":24430651,"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","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["grid","monome","music","serialosc","webusb"],"created_at":"2024-11-27T16:19:58.585Z","updated_at":"2025-08-09T02:17:14.106Z","avatar_url":"https://github.com/halvves.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebMonome\n\n|   |   |\n|---|---|\n| npm | [0.0.1-alpha.8](https://www.npmjs.com/package/webmonome) |\n| size | [1.96kb minzipped](https://bundlephobia.com/result?p=webmonome@0.0.1-alpha.8) |\n| dependencies | [zero](./package.json) |\n| license | [MIT](./LICENSE) |\n\n*communicate with devices beyond a translator*\n\n`webmonome` is a little library designed to enable communication with monome devices directly from the web browser (bypassing `serialosc`). while `serialosc` is the best choice 99% of the time, i thought that it might be nice to enable the creation of monome apps that required zero install/config.\n\n## usage\n\n### script include\n\n```html\n\u003cscript src=\"https://unpkg.com/webmonome@alpha\"\u003e\u003c/script\u003e\n```\n```js\nconst monome = new WebMonome();\n\nconst btn = document.createElement('button');\nbtn.innerHTML = 'connect';\nbtn.addEventListener('click', () =\u003e {\n  monome.connect();\n});\ndocument.body.appendChild(btn);\n\nconst keydown = e =\u003e {\n  monome.gridLed(e.x, e.y, true);\n};\n\nconst keyup = e =\u003e {\n  monome.gridLed(e.x, e.y);\n};\n\nmonome.on('gridKeyDown', keydown);\nmonome.on('gridKeyUp', keyup);\n```\n\n### import\n\n`npm install webmonome@alpha`\n\n```javascript\nimport WebMonome from 'webmonome';\n\nconst monome = new WebMonome();\n\nconst btn = document.createElement('button');\nbtn.innerHTML = 'connect';\nbtn.addEventListener('click', () =\u003e {\n  monome.connect();\n});\ndocument.body.appendChild(btn);\n\nconst keydown = e =\u003e {\n  monome.gridLed(e.x, e.y, true);\n};\n\nconst keyup = e =\u003e {\n  monome.gridLed(e.x, e.y);\n};\n\nmonome.on('gridKeyDown', keydown);\nmonome.on('gridKeyUp', keyup);\n```\n\n## requirements\n\n`webmonome` relies on the `WebUSB` api. information on browser support for the `WebUSB` api can be found over at [caniuse](https://caniuse.com/#feat=webusb).\n\n`webmonome` also requires that **serialosc is disabled**. On **macOS** open Terminal and execute:\n\n```\nlaunchctl unload /Library/LaunchAgents/org.monome.serialosc.plist\n ```\n\nTo re-enable:\n\n```\nlaunchctl load /Library/LaunchAgents/org.monome.serialosc.plist\n```\n\n## api\n\n`webmonome` is currently very bare bones (as i'm still working out the kinks with WebUSB and the monome serial protocol), but there is enough there to perform most grid operations.\n\n### connect\n\n- initialize WebUSB and connect to device:\n\n  ```javascript\n  monome.connect()\n  ```\n\n### system\n\nsystem responses come in the form of events (see below), but this may be changed to include a callback or promise for ergonomics.\n\n- request device information:\n\n  ```javascript\n  monome.query()\n  ```\n\n- request device id:\n\n  ```javascript\n  monome.getId()\n  ```\n\n- request grid size:\n\n  ```javascript\n  monome.getGridSize()\n  ```\n\n### grid ops\n\n- set a single LED on or off:\n\n  ```javascript\n  monome.gridLed(xCoord, yCoord, on)\n  ```\n  - `xCoord`: integer\n  - `yCoord`: integer\n  - `on`: boolean\n\n\n- set all LEDs on or off:\n\n  ```javascript\n  monome.gridLedAll(on)\n  ```\n  - `on`: boolean\n\n\n- set on/off state for column of LEDs:\n\n  ```javascript\n  monome.gridLedCol(xOffset, yOffset, state)\n  ```\n  - `xOffset`: integer\n  - `yOffset`: integer (floored to multiples of 8 by the device firmware)\n  - `state`: array of up to 8 0/1 bits\n\n\n- set on/off state for row of LEDs:\n\n  ```javascript\n  monome.gridLedRow(xOffset, yOffset, state)\n  ```\n  - `xOffset`: integer (floored to multiples of 8 by the device firmware)\n  - `yOffset`: integer\n  - `state`: array of up to 8 0/1 bits\n\n\n- set on/off state for an 8x8 quad of LEDs:\n\n  ```javascript\n  monome.gridLedMap(xOffset, yOffset, state)\n  ```\n  `xOffset`: integer\n  `yOffset`: integer\n  `state`: array of up to 64 0/1 bits\n\n- set system wide grid intensity:\n\n  ```javascript\n  monome.gridLedIntensity(intensity)\n  ```\n  - `intensity`: integer (0-15)\n\n\n- set single LED to specific level:\n\n  ```javascript\n  monome.gridLedLevel(xCoord, yCoord, level)\n  ```\n  - `xCoord`: integer\n  - `yCoord`: integer\n  - `level`: integer (0-15)\n\n\n- set all LEDs to specific level:\n\n  ```javascript\n  monome.gridLedLevelAll(level)\n  ```\n  - `level`: integer (0-15)\n\n\n- set level state for column of LEDs:\n\n  ```javascript\n  monome.gridLedLevelCol(num: xOffset, num: yOffset, []num: state)\n  ```\n  - `xOffset`: integer\n  - `yOffset`: integer (floored to multiples of 8 by the device firmware)\n  - `state`: array of up to 8 integers (0-15)\n\n\n- set level state for row of LEDs:\n\n  ```javascript\n  monome.gridLedLevelRow(num: xOffset, num: yOffset, []num: state)\n  ```\n  - `xOffset`: integer (floored to multiples of 8 by the device firmware)\n  - `yOffset`: integer\n  - `state`: array of up to 8 integers (0-15)\n\n\n- set level state for an 8x8 quad of LEDs:\n\n  ```javascript\n  monome.gridLedLevelMap(num: xOffset, num: yOffset, []num: state)\n  ```\n  - `xOffset`: integer\n  - `yOffset`: integer\n  - `state`: array of up to 64 integers (0-15)\n\n\n### event system\n\n- subscribe to events:\n\n  ```javascript\n  monome.addEventListener(eventName, callback)\n  ```\n  - `eventName`: string\n  - `callback`: function\n\n\n- unsubscribe from events:\n\n  ```javascript\n  monome.removeEventListener(eventName, callback)\n  ```\n  - `eventName`: string\n  - `callback`: function\n\n### events\n\n  - `query` `{type: num, count: num}`\n  - `getId` `str`\n  - `getGridSize` `{x: num, y: num}`\n  - `gridKeyDown` `{x: num, y: num}`\n  - `gridKeyUp` `{x: num, y: num}`\n\n\n## next steps\n\n* remaining /sys/ commands\n  - grid offsets\n  - addr scan\n  - firmware version\n* arc ops\n* add any additional ops in the monome serial protocol (reaching something similar to libmonome)\n\n## see also\n* [monome protocol](https://monome.org/docs/serialosc/serial.txt)\n* [libmonome](https://github.com/monome/libmonome)\n* [serialosc](https://github.com/monome/serialosc)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalvves%2Fwebmonome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalvves%2Fwebmonome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalvves%2Fwebmonome/lists"}