Created
October 30, 2023 17:40
-
-
Save jacobd/e08fc227671328f6de5cd5a337262396 to your computer and use it in GitHub Desktop.
taktech Web FM synth keyboard binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste in the js console of https://www.taktech.org/takm/WebFMSynth/ | |
const k1wwhich = { 65: 18, 83: 19, 68: 20, 70: 21, 71: 22, 72: 23, 74: 24, 75: 25, 76: 26, 186: 27, 222: 28, 87: 3, 69: 4, 84: 5, 89: 6, 85: 7, 79: 8, 88: 9, 221: 10 }, km = {}; const noteTable = [ new NoteTableItem(28, 0, 44, 110, 54), new NoteTableItem(89, 0, 44, 110, 56), new NoteTableItem(150, 0, 44, 110, 58), new NoteTableItem(233, 0, 44, 110, 61), new NoteTableItem(303, 0, 44, 110, 63), new NoteTableItem(386, 0, 44, 110, 66), new NoteTableItem(447, 0, 44, 110, 68), new NoteTableItem(508, 0, 44, 110, 70), new NoteTableItem(590, 0, 44, 110, 73), new NoteTableItem(660, 0, 44, 110, 75), new NoteTableItem(743, 0, 44, 110, 78), new NoteTableItem(804, 0, 44, 110, 80), new NoteTableItem(866, 0, 44, 110, 82), new NoteTableItem(0, 0, 9, 188, 52), new NoteTableItem(9, 0, 51, 188, 53), new NoteTableItem(60, 0, 51, 188, 55), new NoteTableItem(111, 0, 51, 188, 57), new NoteTableItem(162, 0, 51, 188, 59), new NoteTableItem(213, 0, 51, 188, 60), new NoteTableItem(264, 0, 51, 188, 62), new NoteTableItem(315, 0, 51, 188, 64), new NoteTableItem(366, 0, 51, 188, 65), new NoteTableItem(417, 0, 51, 188, 67), new NoteTableItem(468, 0, 51, 188, 69), new NoteTableItem(519, 0, 51, 188, 71), new NoteTableItem(570, 0, 51, 188, 72), new NoteTableItem(621, 0, 51, 188, 74), new NoteTableItem(672, 0, 51, 188, 76), new NoteTableItem(723, 0, 51, 188, 77), new NoteTableItem(774, 0, 51, 188, 79), new NoteTableItem(825, 0, 51, 188, 81), new NoteTableItem(876, 0, 51, 188, 83), ]; $(window).on("keydown", (e) => { const i = k1wwhich[e.which]; if (km[i]) { return; } km[i] = true; if (i) { const noteNo = noteTable[i].noteNo; p.noteOn(noteNo, p.velocity); $("#keymask") .css("left", noteTable[i].x) .width(noteTable[i].w) .height(noteTable[i].h) .show(); } }); $(window).on("keyup", (e) => { const i = k1wwhich[e.which]; km[i] = false; if (i) { const noteNo = noteTable[i].noteNo; p.noteOff(noteNo); $("#keymask").hide(); } }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment