piano icon indicating copy to clipboard operation
piano copied to clipboard

Add possibility to play more than one key on piano

Open felipefialho opened this issue 6 years ago • 8 comments

felipefialho avatar Apr 17 '18 13:04 felipefialho

@LFeh i'm trying developing this issue and i'm not to get success, because i cannot can get multiples keys events, just the last.

I believe that the idea from this issue is if the user press the keys "A" and "D" in the same time, so both piano keys should be pressed, but for now, just the last key is pressed.

Do you have some tip to do it? I'm searching about javascript event listener and for now, i don't have get success.

Thank you

tota1099 avatar Feb 19 '19 13:02 tota1099

Hey @tota1099, how are you?

Check if this example help you: http://jsfiddle.net/vor0nwe/mkHsU/

felipefialho avatar Feb 19 '19 19:02 felipefialho

@LFeh i'm fine and you?

Sorry for arrive "out of thin air" but i'm trying start to make contributions in the github projects and i like your project and looks fine to start.

About your example, maybe i don't have understand right the idea:

The link when you click in the key "A" and "D" (example), the script just understand the "keydown" from the last key. If you remove the condictions if (!li) { [..] } and press both keys for some seconds, just the last key clicked that is added in the list.

You can see my example: https://jsfiddle.net/Tota1099/L86fec9j/1/

Press and hold the keys "A" and "D" in my example, just the last key clicked that will be showed.

I had understand that the idea from Piano is that the user can press two or more keys in the same time. Do you can please explain better the idea? (if i have understand wrong)

Thank you :)

tota1099 avatar Feb 19 '19 20:02 tota1099

You are right.

I never try develop this issue and I can't think in a fast solution.

@fdaciuk Can you help us here?

felipefialho avatar Feb 21 '19 22:02 felipefialho

I can play a full accord =) Is that the problem here?

fdaciuk avatar Feb 22 '19 00:02 fdaciuk

@fdaciuk Do you know how to press multiple keys in same time using javascript?

felipefialho avatar Feb 22 '19 13:02 felipefialho

@felipefialho the same way you did on this project =) I guess it is not a software limitation, but a hardware limitation. Some keyboards might have limitations about pressing more than one key at a time, but this project is working properly.

fdaciuk avatar Feb 22 '19 13:02 fdaciuk

perfect, i had imagine it :/

felipefialho avatar Feb 22 '19 13:02 felipefialho