Hello, I've been programing some simple games using Javascript, games where you use your keyboard or your mouse. However, I've been wondering if a USB Piano works. I mean, if we can "read" the keys you press with your own USB Piano. Have anyone tried it or even heard about it? I have been searching about this and found nothing. Thanks in advice. Azhpo.
It may or may not work, depending on how the piano handles input. Try plugging your piano in, go to http://www.jsrpg.com/keytest.php, and press one of the keys.
MOST USB musical instruments (an area I'm a wee bit experienced at dealing with) work via MIDI over USB. Since browsers have absolutely ZERO MIDI input support... I would say it is VERY unlikely for piano style synth to be accessible via javascript. Especially since you'd lose velocity data (if any -- the good ones say how hard you hit), and there are more range of keys (128) supported by MIDI than there are on a normal keyboard. Kind of wish Javascript did have midi input support -- it would simplify making control applications for the EWI USB or my Current 'hush hush' project.. You may be able to leverage your javascript/html/css skills though by building a Metro application or something mixing native code with browser code via a tool like XULRunner. Would still mean you'd have to learn how to program MIDI though -- and don't expect that to work cross platform without some painfully buggy libraries or a lot of custom code. Also, javascript is typically NOT viable for realtime music playback from an instrument -- the latency is just too damned high. See the 'allegedly' playable standalone piano apps for things like android or iOS, that are from a true musicians standpoint useless unplayable toys due to the MASSIVE delay between hitting a "key" and it actually making noise. EWI USB players deal with that all the time on windows with machines that don't have proper ASIO support.