Skip to content

Conversation

@ZHaiiiNINnnG
Copy link

Hello. I am a student majoring in computer science and I'm also a music enthusiast. When I ran this piano project, I found that it couldn't produce the sound corresponding to each key, so I wanted to implement this functionality. I started by importing the sounds folder, which contains audio files for three octaves of the piano, from C3 to B5. And then, I begin to work with the code.In the code, each key has an embedded audio element, and the audio element is positioned at the bottom of the key using CSS. Additionally, other controls except the play button are hidden via CSS pseudo-element selectors. This way, users can see a play button at the bottom of each key, and clicking it will play the corresponding note.
However, the original code does not allow clicking the entire key (rather than just the play button) to play the sound. This is because JavaScript WAS NOT USED to bind a click event to the entire key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant