{"id":18063026,"url":"https://github.com/stagas/x-pianokeys","last_synced_at":"2025-09-10T00:17:11.839Z","repository":{"id":57690453,"uuid":"451992879","full_name":"stagas/x-pianokeys","owner":"stagas","description":"Web Component MIDI ready piano keys.","archived":false,"fork":false,"pushed_at":"2023-02-11T18:39:50.000Z","size":137,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T11:21:47.424Z","etag":null,"topics":["daw","keys","midi","piano","ui","web-component"],"latest_commit_sha":null,"homepage":"","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/stagas.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}},"created_at":"2022-01-25T18:20:36.000Z","updated_at":"2023-03-08T04:01:57.000Z","dependencies_parsed_at":"2023-02-17T05:15:20.500Z","dependency_job_id":null,"html_url":"https://github.com/stagas/x-pianokeys","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":"stagas/ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fx-pianokeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fx-pianokeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fx-pianokeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stagas%2Fx-pianokeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stagas","download_url":"https://codeload.github.com/stagas/x-pianokeys/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429117,"owners_count":21101785,"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":["daw","keys","midi","piano","ui","web-component"],"created_at":"2024-10-31T05:09:11.280Z","updated_at":"2025-04-11T15:13:33.854Z","avatar_url":"https://github.com/stagas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\u003ch1\u003e\nx-pianokeys \u003ca href=\"https://npmjs.org/package/x-pianokeys\"\u003e\u003cimg src=\"https://img.shields.io/badge/npm-v3.1.0-F00.svg?colorA=000\"/\u003e\u003c/a\u003e \u003ca href=\"src\"\u003e\u003cimg src=\"https://img.shields.io/badge/loc-693-FFF.svg?colorA=000\"/\u003e\u003c/a\u003e \u003ca href=\"https://cdn.jsdelivr.net/npm/x-pianokeys@3.1.0/dist/x-pianokeys.min.js\"\u003e\u003cimg src=\"https://img.shields.io/badge/brotli-11.2K-333.svg?colorA=000\"/\u003e\u003c/a\u003e \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-F0B.svg?colorA=000\"/\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\nWeb Component MIDI ready piano keys.\n\n\u003ch4\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd title=\"Triple click to select and copy paste\"\u003e\n\u003ccode\u003enpm i x-pianokeys \u003c/code\u003e\n\u003c/td\u003e\u003ctd title=\"Triple click to select and copy paste\"\u003e\n\u003ccode\u003epnpm add x-pianokeys \u003c/code\u003e\n\u003c/td\u003e\u003ctd title=\"Triple click to select and copy paste\"\u003e\n\u003ccode\u003eyarn add x-pianokeys\u003c/code\u003e\n\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\u003c/h4\u003e\n\n## Examples\n\n\u003cdetails id=\"example$web\" title=\"web\" open\u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#example$web\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eweb\u003c/strong\u003e\u003c/code\u003e\u003c/summary\u003e  \u003cul\u003e\u003cp\u003e\u003c/p\u003e  \u003ca href=\"https://stagas.github.io/x-pianokeys/example/web.html\"\u003e\u003cimg width=\"400\" src=\"example/web.webp\"\u003e\u003c/img\u003e  \u003cp\u003e\u003cstrong\u003eTry it live\u003c/strong\u003e\u003c/p\u003e\u003c/a\u003e    \u003cdetails id=\"source$web\" title=\"web source code\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#source$web\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eview source\u003c/strong\u003e\u003c/code\u003e\u003c/summary\u003e  \u003ca href=\"example/web.tsx\"\u003eexample/web.tsx\u003c/a\u003e  \u003cp\u003e\n\n```tsx\n/** @jsxImportSource minimal-view */\n\nimport { render } from 'minimal-view'\n\nimport { PianoKeys } from 'x-pianokeys'\n\ndocument.body.innerHTML = /*html*/ `\n\u003cstyle\u003e\nhtml, body {\n  width: 100%;\n  height: 100%;\n}\n.piano {\n  resize: both;\n  overflow: hidden;\n}\n\u003c/style\u003e\n\u003cdiv id=\"demo\" style=\"display: flex; gap:20px\"\u003e\u003c/div\u003e\n`\nconst audioContext = new AudioContext()\nrender(\n  \u003c\u003e\n    \u003cdiv style=\"height:250px;width:50px\"\u003e\n    \u003cPianoKeys\n      halfOctaves={3}\n      startHalfOctave={1}\n      vertical\n      audioContext={audioContext}\n      onMidiEvent={() =\u003e { }}\n    /\u003e\n    \u003c/div\u003e\n\n    \u003cdiv style=\"height:250px;width:50px\"\u003e\n    \u003cPianoKeys\n      halfOctaves={2}\n      startHalfOctave={1}\n      vertical\n      audioContext={audioContext}\n      onMidiEvent={() =\u003e { }}\n    /\u003e\n    \u003c/div\u003e\n\n    \u003cdiv style=\"height:250px;width:50px\"\u003e\n    \u003cPianoKeys\n      halfOctaves={3}\n      startHalfOctave={0}\n      vertical\n      audioContext={audioContext}\n      onMidiEvent={() =\u003e { }}\n    /\u003e\n    \u003c/div\u003e\n\n    \u003cdiv style=\"height:250px;width:50px\"\u003e\n    \u003cPianoKeys\n      halfOctaves={2}\n      startHalfOctave={0}\n      vertical\n      audioContext={audioContext}\n      onMidiEvent={() =\u003e { }}\n    /\u003e\n    \u003c/div\u003e\n  \u003c/\u003e,\n  document.getElementById('demo')!\n)\n// setTimeout(() =\u003e {\n//   document.querySelector('x-piano')!.turnOnKey(2)\n//   document.querySelector('x-piano')!.turnOnKey(5)\n//   document.querySelector('x-piano')!.turnOnKey(3)\n// }, 1000)\n// \u003cdiv class=\"piano\" style=\"width:100px;height:350px;\"\u003e\n//   \u003cx-piano vertical onmidimessage=\"console.log(event)\"\u003e\u003c/x-piano\u003e\n// \u003c/div\u003e\n\n// for demo: requestAnimationFrame \u003c- for shoty\n// const pianos = document.querySelectorAll('x-piano') as NodeListOf\u003cPianoKeysElement\u003e\n// let ivl = setInterval(() =\u003e {\n//   const piano = pianos[Math.random() * pianos.length | 0]\n//   const note = Math.random() * 20 | 0\n//   piano.turnOnKey?.(note)\n//   setTimeout(() =\u003e piano.turnOffKey?.(note), Math.random() * 1500)\n// }, 50)\n// setTimeout(() =\u003e {\n//   clearInterval(ivl)\n// }, 1000)\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\u003c/ul\u003e\u003c/details\u003e\n\n\n## API\n\n\u003cp\u003e  \u003cdetails id=\"MidiEvents$1\" title=\"TypeAlias\" open\u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#MidiEvents$1\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eMidiEvents\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"\"\u003e\u003c/a\u003e  \u003cul\u003e\u003cp\u003e{\u003cp\u003e  \u003cdetails id=\"midimessage$3\" title=\"Property\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#midimessage$3\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003emidimessage\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e  \u003ca href=\"\"\u003e\u003c/a\u003e  \u003cul\u003e\u003cp\u003e\u003cspan\u003eWebMidi.MIDIMessageEvent\u003c/span\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e}\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e\u003cdetails id=\"PianoKeys$4\" title=\"Function\" open\u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#PianoKeys$4\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003ePianoKeys\u003c/strong\u003e\u003c/code\u003e\u003cem\u003e(props)\u003c/em\u003e    \u003c/summary\u003e  \u003ca href=\"\"\u003e\u003c/a\u003e  \u003cul\u003e    \u003cp\u003e    \u003cdetails id=\"props$6\" title=\"Parameter\" \u003e\u003csummary\u003e\u003cspan\u003e\u003ca href=\"#props$6\"\u003e#\u003c/a\u003e\u003c/span\u003e  \u003ccode\u003e\u003cstrong\u003eprops\u003c/strong\u003e\u003c/code\u003e    \u003c/summary\u003e    \u003cul\u003e\u003cp\u003e\u003cspan\u003eprops\u003c/span\u003e\u003c/p\u003e        \u003c/ul\u003e\u003c/details\u003e  \u003cp\u003e\u003cstrong\u003ePianoKeys\u003c/strong\u003e\u003cem\u003e(props)\u003c/em\u003e  \u0026nbsp;=\u0026gt;  \u003cul\u003e\u003cspan\u003eVKid\u003c/span\u003e\u003c/ul\u003e\u003c/p\u003e\u003c/p\u003e    \u003c/ul\u003e\u003c/details\u003e\u003c/p\u003e\n\n## Credits\n- [minimal-view](https://npmjs.org/package/minimal-view) by [stagas](https://github.com/stagas) \u0026ndash; Minimal reactive component view library.\n- [to-fluent](https://npmjs.org/package/to-fluent) by [stagas](https://github.com/stagas) \u0026ndash; Convert a function with a settings object to fluent API.\n- [webaudio-tools](https://npmjs.org/package/webaudio-tools) by [stagas](https://github.com/stagas) \u0026ndash; Useful tools for WebAudio.\n\n## Contributing\n\n[Fork](https://github.com/stagas/x-pianokeys/fork) or [edit](https://github.dev/stagas/x-pianokeys) and submit a PR.\n\nAll contributions are welcome!\n\n## License\n\n\u003ca href=\"LICENSE\"\u003eMIT\u003c/a\u003e \u0026copy; 2023 [stagas](https://github.com/stagas)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstagas%2Fx-pianokeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstagas%2Fx-pianokeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstagas%2Fx-pianokeys/lists"}