Ameobea / web-synth

A web-based sound synthesis, music production, and audio experimentation platform
https://synth.ameo.dev
Other
457 stars 22 forks source link

Use `keyCode` instead of `key` for keyup/keydown events #9

Closed freddyb closed 2 months ago

freddyb commented 3 years ago

Hey,

Aside: first of all, huge kudos for pulling this off. I have especially enjoyed the technical write-up. For context: I know how to play a keyboard but have never used a synthesizer user so I'm still fooling around.

I noticed that your MidiKeyboard implementation is based upon a keyMap using letters to identify keys on the keyboard. While this works well on a US keyboard, it is a bit cumbersome on others. E.g., on a German keyboard, the letters "z" and "y" are swapped and playing notes would involve a some odd finger gymnastics :)

A possible solution is to use the key's code as they translate roughly to button-positions on the keyboard rather than what is actually printed on the keycap.

Thanks!

Ameobea commented 3 years ago

Hey, tyvm for trying the synth and opening this issue!

I 100% agree key codes is a much better way to handle this, and I'll get this implemented.