I have tried many methods, and I’m a simple beginner with JavaScript but I want to make a site where I can play a digital piano (without a piano) and have it group keys together that I press at the same time.
For example, if I press "a" then "b" then I press "c" at the same time as "d" it will format it like this: "a b [cd]". I’ve gotten to the point to where I’ve failed so many times that I asked ChatGPT, but even it was no help. I Wasn’t Surprised
2
Answers
I’m not exactly sure what you’re looking for. The notes should be displayed in a text box or div?
hello, keyboard events
Here’s a minimal proof of concept. Run the demo below –
From there, you will want to connect the state changes to WebAudio calls, such as –
hello, music to my ears
Expanding on the code above, we make a
piano
from a QWERTY keyboard layout –Then a
createOsc
that computes the frequency for the semitone and plays it –Run the snippet below and play your next masterpiece –