[alsa-devel] python midi wrapper

Takashi Iwai tiwai at suse.de
Mon Jan 7 11:56:34 CET 2008


At Fri, 4 Jan 2008 15:01:39 -0300,
Aldrin Martoq wrote:
> 
> Hello, I need a midi/seq wrapper for Python. I've already created some
> code for the sequencer API and works great! Here is my python test
> code:
> 
> --------------------------------------------------------------------
> #!/usr/bin/env python
> 
> import sys
> sys.path.append('build/lib.linux-i686-2.5')
> import alsaaudio
> 
> print "Creating Sequencer..."
> seq = alsaaudio.Seq("hw", "Python seqtest.py",
> alsaaudio.SEQ_OPEN_DUPLEX, alsaaudio.SEQ_NONBLOCK)
> myid = seq.get_client_id()
> print "... seq:", myid, seq
> print "Creating Port..."
> myport = seq.create_simple_port("Processor port",
> alsaaudio.SEQ_PORT_CAP_WRITE | alsaaudio.SEQ_PORT_CAP_SUBS_WRITE,
> alsaaudio.SEQ_PORT_TYPE_APPLICATION)
> print "... port:", myport
> #queue = seq.create_queue()
> #print "... queue:", queue
> 
> # dump clients and ports
> def dump_connection():
> 	print
> 	print "Client/ports available:"
> 	for client in seq.get_client_ports():
> 		clientname, clientid, portlist = client
> 		print " client: %3d    %s" % (clientid, clientname)
> 		for port in portlist:
> 			portname, portid, connections = port
> 			print "   port: %3d:%-2d   +-%s" % (clientid, portid, portname)
> 			readconn, writeconn = connections
> 			for conn in readconn:
> 				print "     connection   to: %s" % conn
> 			for conn in writeconn:
> 				print "     connection from: %s" % conn
> 
> dump_connection() Is the front
> seq.connect_ports("0:1", "%d:%d" % (myid, myport));
> seq.connect_ports("24:0", "%d:%d" % (myid, myport));
> dump_connection()
> 
> 
> while True:
> 	events = seq.receive_events(60000)
> 	for ev in events:
> 		print ev
> 		print "\t", ev.data()
> 
> --------------------------------------------------------------------
> 
> 
> 
> I have tried to contact the mantainer of PyAlsaAudio (cwi at unispeed.dk
> from the README file) for merging my code in his project, but have not
> received a response so far and the date of files seems old.
> 
> Is anybody here interested in the merge? How can I put this effor in
> python-alsaaudio or may I create a new project for this specific task?
> Is the pyalsa project related to pyalsaaudio?

So far, pyalsaaudio is an independent project.
I've not checked the pyalsaaudio codes yet, but if it's worth to
merge, it'd be surely possible to create a repo...


Takashi


More information about the Alsa-devel mailing list