{"id":13805054,"url":"https://github.com/kylestetz/AudioKeys","last_synced_at":"2025-05-13T18:33:09.256Z","repository":{"id":35989552,"uuid":"40281243","full_name":"kylestetz/AudioKeys","owner":"kylestetz","description":":musical_keyboard: a QWERTY keyboard for web audio projects","archived":false,"fork":false,"pushed_at":"2023-08-09T06:00:25.000Z","size":278,"stargazers_count":239,"open_issues_count":5,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-06T07:58:23.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/kylestetz.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}},"created_at":"2015-08-06T03:02:00.000Z","updated_at":"2025-03-26T22:08:25.000Z","dependencies_parsed_at":"2024-06-19T01:51:16.450Z","dependency_job_id":"b464332e-d92b-4a41-a05e-04e86a930bea","html_url":"https://github.com/kylestetz/AudioKeys","commit_stats":{"total_commits":80,"total_committers":3,"mean_commits":"26.666666666666668","dds":"0.15000000000000002","last_synced_commit":"c04268429915a50d51870b6d94944febcd0114be"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylestetz%2FAudioKeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylestetz%2FAudioKeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylestetz%2FAudioKeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylestetz%2FAudioKeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kylestetz","download_url":"https://codeload.github.com/kylestetz/AudioKeys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254003484,"owners_count":21997896,"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-08-04T01:00:56.906Z","updated_at":"2025-05-13T18:33:08.816Z","avatar_url":"https://github.com/kylestetz.png","language":"JavaScript","funding_links":[],"categories":["Obsolete"],"sub_categories":["Community"],"readme":"\u003cimg src=\"https://raw.github.com/kylestetz/audiokeys/master/audiokeys.jpg\" /\u003e\n\n# AudioKeys\n\n[![Build Status](https://travis-ci.org/kylestetz/AudioKeys.svg)](https://travis-ci.org/kylestetz/AudioKeys)\n\n#### Bring your own sound.\n\nUse AudioKeys to power the QWERTY keyboard in your next Web Audio project. AudioKeys provides **intelligent handling of key events**, giving you key up and key down events that you can use to trigger your sounds.\n\nAudioKeys provides **configurable polyphony**— if you're making a monophonic synth, choose from the common note priorities \"last note\", \"first note\", \"highest note\", or \"lowest note\". It also handles odd situations like switching tabs— AudioKeys fires a note off event when your browser window goes out of focus.\n\nChoose from two common key layouts, one of which supports optional octave shifting and velocity selecting.\n\n\u003cimg src=\"https://raw.github.com/kylestetz/audiokeys/master/images/audiokeys-mapping-rows1.jpg\" /\u003e\n\n\u003cimg src=\"https://raw.github.com/kylestetz/audiokeys/master/images/audiokeys-mapping-rows2.jpg\" /\u003e\n\n# Installation\n\n#### Using `npm`\n\n```bash\n$ npm install audiokeys --save\n```\n\nUse it in your project by requiring or importing it, depending on your build system.\n\n```javascript\n// Using `require`\nconst AudioKeys = require('audiokeys');\n\n// Using `import`\nimport AudioKeys from 'audiokeys';\n```\n\n#### Grab the source directly\n\nDownload [`dist/audiokeys.js`](https://github.com/kylestetz/AudioKeys/blob/master/dist/audiokeys.js) or [`dist/audiokeys.min.js`](https://github.com/kylestetz/AudioKeys/blob/master/dist/audiokeys.min.js) and include it in the `\u003chead\u003e` of your markup:\n```html\n\u003cscript src=\"/js/audiokeys.js\"\u003e\u003c/script\u003e\n```\n\nNow you will have the `AudioKeys(options)` function available to use.\n\n---\n\n# Usage\n\n```javascript\n// create a keyboard\nvar keyboard = new AudioKeys();\n\nkeyboard.down( function(note) {\n  // do things with the note object\n});\n\nkeyboard.up( function(note) {\n  // do things with the note object\n});\n```\n\n##### The note object has cool stuff in it.\n\nThe object you get back in a `down` or `up` callback includes:\n\n```javascript\n{\n  // the midi number of the note\n  note: 60,\n  // the keyCode of the key being pressed down\n  keyCode: 65,\n  // the frequency of the note\n  frequency: 261.6255653005986,\n  // on note down: the current velocity (this can only be set when rows = 1)\n  // on note up: 0\n  velocity: 127\n}\n```\n\nThese properties will be useful in setting up oscillators. See the [`test/index.html`](https://github.com/kylestetz/AudioKeys/blob/master/test/index.html) file for a simple example.\n\n### API\n\nThere are several options that can be set to configure your keyboard object. They can be passed into the `AudioKeys` constructor in an object or set individually using `set`.\n\n```javascript\n// properties can be passed into the AudioKeys object\nvar keyboard = new AudioKeys({\n  polyphony: 1,\n  rows: 2,\n  priority: 'lowest'\n});\n\n// all properties can also be set later\nkeyboard.set('priority', 'highest');\n```\n\n##### `keyboard.set(property, value)`\n##### `keyboard.get(property, value)`\n\nThe state of the keyboard can be read and changed using the `set` and `get` methods. Here are the properties:\n\n###### `polyphony`\nThe number of keys that can be active simultaneously.\n\n###### `rows`\nEither `1` or `2`, see the diagrams above.\n\n###### `octaveControls`\nDetermines whether or not the `z` and `x` keys shift octaves when `rows` is set to `1`.\n\n###### `velocityControls`\nDetermines whether or not the number keys set the velocity of the notes being triggered. Keep in mind that velocity is just a number— you have to interpret it in your sounds!\n\n###### `priority`\nDetermines the priority of the note triggers. Priority only takes effect when the number of keys being pressed down exceeds the polyphony (e.g. when the polyphony is 1 but a second key is pressed).\n\n- `\"last\"`: prefer the last note(s) pressed\n- `\"first\"`: prefer the first note(s) pressed\n- `\"highest\"`: prefer the highest note(s) pressed\n- `\"lowest\"`: prefer the lowest note(s) pressed\n\nFor more on note priority, check out [this Sound on Sound article](https://web.archive.org/web/20150913012148/http://www.soundonsound.com/sos/oct00/articles/synthsec.htm).\n\n###### `rootNote`\nDetermines what note the lowest key on the keyboard will represent. The default is `60` (C4). Keep in mind that setting it to a note other than C (36, 48, 60, 72, 84, etc.) will result in the key mappings not lining up like a regular keyboard!\n\n\n------------------------------------\n\n##### TODO\n- [x] Get it working!\n- [x] Implement octave shifting (for `rows=1`)\n- [x] Implement velocity selection (for `rows=1`)\n- [ ] Demo site\n- [ ] Add MIDI support","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkylestetz%2FAudioKeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkylestetz%2FAudioKeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkylestetz%2FAudioKeys/lists"}