keypress and keyrelease as separate events 
Author Message
 keypress and keyrelease as separate events

I would like to know if it is possible to be told separately when the
user presses a key, and when they release that key. I am attempting to
write a MIDI program which includes a small piano interface. This
interface will simulate the layout of a piano as mapped onto the first
and second rows of the keyboard. Towards this end, I need to be told
when the user presses down a key and when they release that key
separately, so that I know when to begin playing the note and when to
cut it off.

Is there such a function or module?

--
Kerne

I have searched through cpan, perldoc, and the camel book for such a
function, although perhaps not sufficiently thoroughly.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 keypress and keyrelease as separate events

Quote:

>I would like to know if it is possible to be told separately when the
>user presses a key, and when they release that key. I am attempting to
>write a MIDI program which includes a small piano interface. This
>interface will simulate the layout of a piano as mapped onto the first
>and second rows of the keyboard. Towards this end, I need to be told
>when the user presses down a key and when they release that key
>separately, so that I know when to begin playing the note and when to
>cut it off.

>Is there such a function or module?

...

Check out the Tk.pm module.

It has KeyPress and KeyRelease bindings, and a bunch of GUI controls
you might find useful.



Wed, 18 Jun 1902 08:00:00 GMT  
 keypress and keyrelease as separate events
Also check out The Perl Journal from Spring 1999. There is an article
about the MIDI::Simple module.


Wed, 18 Jun 1902 08:00:00 GMT  
 keypress and keyrelease as separate events


Quote:
> Check out the Tk.pm module.

> It has KeyPress and KeyRelease bindings, and a bunch of GUI controls
> you might find useful.

Not, I am afraid, a solution (though it looks awfully nice); the program
will be for use in console. (That is one of the reasons why I'm writing
it myself, rather than availing myself of one of the extant MIDI
programs for linux: I'm a console junkie, and they're all resolutely for
use within X.)

It's beginning to look as though the actual playing of notes on the
keyboard, if not the job as a whole, will have to be done by something
other than perl. I should think that perl would be really good at
handling the complex data structure of a MIDI score, but the playing of
notes is something else.

--
Kerne

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 keypress and keyrelease as separate events


Quote:
> I would like to know if it is possible to be

told separately when the

Quote:
> user presses a key, and when they release that
key.

Try looking for curses if you like doing console
apps.

PoD.

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Separating the ButtonPress and ButtonRelease events

2. Getting comma separated number from comma separated file

3. POE 0.11: event driven state machines, also supports Perl/Tk and Event

4. HTML::Parser 3.07 text events vs token events

5. Processing other events while waiting for an event to happen

6. acting on non event-oriented events

7. file events vs. window events

8. How do you bind keypress events to an entire canvas?

9. AS Perl, capture keypress outside window focus

10. Emulate a keypress?

11. Can YOU Catch Each Keypress?

12. I need to simulate keyboard keypress to an external application

 

 
Powered by phpBB® Forum Software