Skip to content

Commit

Permalink
extended keyboard (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregzanch authored Nov 29, 2024
1 parent a347351 commit 14c2f78
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/audio/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const octaveFrequencyMap: Record<string, number> = {
["b"]: 61.73541,
};

octaveFrequencyMap["c2"] = octaveFrequencyMap["c"] * 2;
octaveFrequencyMap["c#2"] = octaveFrequencyMap["c#"] * 2;
octaveFrequencyMap["d2"] = octaveFrequencyMap["d"] * 2;
octaveFrequencyMap["d#2"] = octaveFrequencyMap["d#"] * 2;
octaveFrequencyMap["e2"] = octaveFrequencyMap["e"] * 2;

const keyToNoteMap: Record<string, string> = {
["w"]: "c#",
["e"]: "d#",
Expand All @@ -33,6 +39,11 @@ const keyToNoteMap: Record<string, string> = {
["g"]: "g",
["h"]: "a",
["j"]: "b",
["k"]: "c2",
["l"]: "d2",
[";"]: "e2",
["o"]: "c#2",
["p"]: "d#2",
};

export class Engine {
Expand Down
6 changes: 6 additions & 0 deletions src/lib/Keyboard/Keyboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
<Key label="T" kind="dark" keybinding="t" keydown={createKeydownFunction("t")} keyup={createKeyupFunction("t")} {contextMatcher} />
<Key label="Y" kind="dark" keybinding="y" keydown={createKeydownFunction("y")} keyup={createKeyupFunction("y")} {contextMatcher} />
<Key label="U" kind="dark" keybinding="u" keydown={createKeydownFunction("u")} keyup={createKeyupFunction("u")} {contextMatcher} />
<div class="empty-key"></div>
<Key label="O" kind="dark" keybinding="o" keydown={createKeydownFunction("o")} keyup={createKeyupFunction("o")} {contextMatcher} />
<Key label="P" kind="dark" keybinding="p" keydown={createKeydownFunction("p")} keyup={createKeyupFunction("p")} {contextMatcher} />
</div>
<div class="lower">
<Key label="A" kind="light" keybinding="a" keydown={createKeydownFunction("a")} keyup={createKeyupFunction("a")} {contextMatcher} />
Expand All @@ -59,6 +62,9 @@
<Key label="G" kind="light" keybinding="g" keydown={createKeydownFunction("g")} keyup={createKeyupFunction("g")} {contextMatcher} />
<Key label="H" kind="light" keybinding="h" keydown={createKeydownFunction("h")} keyup={createKeyupFunction("h")} {contextMatcher} />
<Key label="J" kind="light" keybinding="j" keydown={createKeydownFunction("j")} keyup={createKeyupFunction("j")} {contextMatcher} />
<Key label="K" kind="light" keybinding="k" keydown={createKeydownFunction("k")} keyup={createKeyupFunction("k")} {contextMatcher} />
<Key label="L" kind="light" keybinding="l" keydown={createKeydownFunction("l")} keyup={createKeyupFunction("l")} {contextMatcher} />
<Key label=";" kind="light" keybinding=";" keydown={createKeydownFunction(";")} keyup={createKeyupFunction(";")} {contextMatcher} />
</div>
</div>

Expand Down

0 comments on commit 14c2f78

Please sign in to comment.