[alsa-devel] problems howto send simple 'noteon' event with pyalsa...

ki.ber.kom.uni.st ki.ber at kom.uni.st
Fri Mar 14 00:24:36 CET 2008

i'm happy that gnu world exists ;) aldrin thanx to remind me on that
once again...

On 3/13/08, Aldrin Martoq <amartoq at dcc.uchile.cl> wrote:
> You can send NOTEON events without a queue, but you cannot send NOTE
>  events without a queue. (subtle difference: note_ON_)

clear enough...

>  The following code will work;

worked as charm... many thanx...

> AFAIK, You don't need a port if you are sending events directly.

you are right.. i can send events directly... in my particular case i
like to have ports so i can connect them with other midi ports through
qjackctl or some other graphical app...

>  Now, if you subscribe and connect ports, you don't need to assign them
>  into the event, because a new event is created with
>  snd_seq_ev_set_subs called..

i don't get this one.. what i tried till know is to create in/out
ports (it works...) and then connect them with some existing ones
using seq.connect_ports.. then if i use seq.output_event(event)
drain_output() works fine... i don't get what 'ports assigning into
the event' would be?

>  You can check this and other stuff with the following code:

once more many thanx.. this was very helpful for me.. i'll keep using
pyalsa and i start to call myself happy user of pyalsa from now on ;)

>  I'm planning to move event.set_data() to attributes, like
>  event.note_note, event.note_velocity ... Tell me what you think!

that seems to me more clear and more consistent with event.dest and
probably some other stuff... also it looks more pythonic i would
say... even set_data() is easy to use too..

i use a lot ipython interactive shell so attributes are shown as
result of auto completion + if you would put """documentation
strings""" it will also come out with basic documentation of what is
it for and how to use it...

> Well, that's what asoundlib says... weird, don't you think?

i was pissed but as usually being the lamest in programming i had no
one but myself to blame ;)

> Remember: python is far away of real-time so if you get weirds timings
>  you may reconsider using a queue anyway!

my pyalsa piece of code is part of handling gamepad events in pyqt4
loop so i thought to send events as soon as i get them from
/dev/input/js0 should be handled without any queue and trying to send
them directly.. am i right in this particular set up?

i'll try to get into queues in the later phase of my development...

More information about the Alsa-devel mailing list