{"id":29128145,"url":"https://github.com/ryohey/web-ble-midi","last_synced_at":"2026-01-20T16:45:12.504Z","repository":{"id":300872131,"uuid":"1007439456","full_name":"ryohey/web-ble-midi","owner":"ryohey","description":"A library for easily handling BLE MIDI input in the browser using Web Bluetooth API.","archived":false,"fork":false,"pushed_at":"2025-06-25T02:07:03.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-28T23:58:21.379Z","etag":null,"topics":["ble","midi","typescript","web","web-bluetooth"],"latest_commit_sha":null,"homepage":"https://ryohey.github.io/web-ble-midi/","language":"TypeScript","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/ryohey.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":"2025-06-24T02:17:34.000Z","updated_at":"2025-09-24T16:14:02.000Z","dependencies_parsed_at":"2025-07-18T05:55:47.731Z","dependency_job_id":"06881c79-e6ab-420a-a7de-884f9e9b44c6","html_url":"https://github.com/ryohey/web-ble-midi","commit_stats":null,"previous_names":["ryohey/web-ble-midi"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ryohey/web-ble-midi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohey%2Fweb-ble-midi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohey%2Fweb-ble-midi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohey%2Fweb-ble-midi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohey%2Fweb-ble-midi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryohey","download_url":"https://codeload.github.com/ryohey/web-ble-midi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohey%2Fweb-ble-midi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278866931,"owners_count":26059671,"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-10-07T02:00:06.786Z","response_time":59,"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":["ble","midi","typescript","web","web-bluetooth"],"created_at":"2025-06-30T01:31:00.392Z","updated_at":"2025-10-08T00:03:55.743Z","avatar_url":"https://github.com/ryohey.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/web-ble-midi.svg)](https://badge.fury.io/js/web-ble-midi) [![Actions Status](https://github.com/ryohey/web-ble-midi/workflows/CI/badge.svg?branch=master)](https://github.com/ryohey/web-ble-midi/actions) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# web-ble-midi\n\nA library for easily handling BLE MIDI input in the browser using Web Bluetooth API.\n\n[Live Demo](https://ryohey.github.io/web-ble-midi/) - Try it with your BLE MIDI device!\n\n## Installation\n\n```bash\nnpm install web-ble-midi --save\n```\n\n## Usage\n\n```ts\nimport { BLEMIDI } from \"web-ble-midi\"\n\n// Check if Web Bluetooth is supported\nif (!BLEMIDI.isSupported()) {\n  console.error(\"Web Bluetooth is not supported in this browser\")\n}\n\n// Scan for a device\nasync function scanAndConnect() {\n  try {\n    // Will prompt the user to select a device with a browser dialog\n    const device = await BLEMIDI.scan({\n      namePrefix: \"BLE-MIDI\", // Optional: filter by name prefix\n    })\n\n    console.log(\"Selected device:\", device.name)\n\n    // Register event listeners\n    device.addEventListener(\"midimessage\", (event) =\u003e {\n      // MIDIMessageEvent has a message property with the MIDI data\n      const message = event.message\n      console.log(\"Received MIDI message:\", message)\n\n      // Access the raw MIDI data\n      const statusByte = message.message[0]\n      const channel = statusByte \u0026 0x0f\n\n      // Handle note-on messages\n      if ((statusByte \u0026 0xf0) === 0x90 \u0026\u0026 message.message[2] \u003e 0) {\n        const noteNumber = message.message[1]\n        const velocity = message.message[2]\n        console.log(\n          `Note On - Channel: ${\n            channel + 1\n          }, Note: ${noteNumber}, Velocity: ${velocity}`\n        )\n      }\n    })\n\n    device.addEventListener(\"disconnect\", () =\u003e {\n      console.log(\"Device disconnected\")\n    })\n\n    // Connect to the device\n    await device.connect()\n    console.log(\"Connected to device:\", device.name)\n\n    // Later, when you want to disconnect:\n    // device.disconnect();\n  } catch (error) {\n    if (error.name === \"NotFoundError\") {\n      console.log(\"User cancelled the device selection\")\n    } else {\n      console.error(\"Connection error:\", error)\n    }\n  }\n}\n\n// Trigger scanning when a button is clicked\ndocument\n  .getElementById(\"connectButton\")\n  .addEventListener(\"click\", scanAndConnect)\n```\n\n## Parser State Machine\n\nThe MIDI parser in this library operates according to the following state machine:\n\n```mermaid\nstateDiagram-v2\n    [*] --\u003e sysExHeader: SysEx receiving\n    [*] --\u003e header: otherwise\n\n    sysExHeader --\u003e sysExEnd: 0xf7\n    sysExHeader --\u003e sysExSystem: 0x80-0xff\n    sysExHeader --\u003e sysExData: 0x00-0x7f\n\n    sysExData --\u003e sysExEnd: 0xf7\n    sysExData --\u003e sysExSystem: 0x80-0xff\n    sysExData --\u003e sysExTimestamp: timestamp\n    sysExData --\u003e sysExData: 0x00-0x7f\n\n    sysExSystem --\u003e sysExTimestamp: timestamp\n    sysExSystem --\u003e sysExData: 0x00-0x7f\n\n    sysExTimestamp --\u003e sysExEnd: 0xf7\n    sysExTimestamp --\u003e sysExSystem: 0x80-0xff\n    sysExTimestamp --\u003e sysExData: 0x00-0x7f\n\n    sysExEnd --\u003e header\n\n    header --\u003e firstTimestamp\n\n    firstTimestamp --\u003e sysExStart: 0xf0\n    firstTimestamp --\u003e fullMessage: others\n\n    sysExStart --\u003e sysExData\n\n    fullMessage --\u003e timestamp\n\n    timestamp --\u003e sysExStart: 0xf0\n    timestamp --\u003e fullMessage: 0x80-0xef\n    timestamp --\u003e runningStatus: 0x00-0x7f\n    timestamp --\u003e system: 0xf1-0xff\n    timestamp --\u003e [*]: end\n\n    runningStatus --\u003e timestamp\n    runningStatus --\u003e runningStatus\n\n    system --\u003e timestamp\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryohey%2Fweb-ble-midi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryohey%2Fweb-ble-midi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryohey%2Fweb-ble-midi/lists"}