key capture

Tino Wildenhain tino at wildenhain.de
Mon Feb 2 05:45:21 EST 2009


Hi,

swamynathan wrote:
> hello,
> im making a virtual piano in python where on key stroke a wav is played 
> from a location
> now to implement  a fully functional piano i need to have multiple key 
> stroke captures  ie if 2 or 3 keys pressed then the function which 
> playes the wav is called with 3 parameters


> how to implement this or any other suggestion(i was asked to try multi 
> threading which dint seem optimal)

Are you trying to do this with a computer keyboard or with an
attached midi or usb music keybord? If the former, you are probably
w/o luck because afaik there is no way to track the event
of having random keys pressed the same time.
(Last time I did it was with a real C=64 where you have access
  to the key matrix)

If you manage to receive the keypress events, multithreading is
probably easiest to do but it really depends on the way you
play the sounds - at least the playback needs to be asynchronously
so you can catch note-on, note-off events during playback.

Good luck
Tino
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090202/2f2109bc/attachment.bin>


More information about the Python-list mailing list