Skip to contentSkip to conversation

python midi wrapper

DISCUSSION Aldrin Martoq 3 participants 3 messages Jan 4, 2008 – Jan 7, 2008

lore
Share & tools
lore
#0 lore raw

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 ([email protected] 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?

Thanks,

Signature · 1 line
Aldrin Martoq
#1 lore raw

At Fri, 4 Jan 2008 15:01:39 -0300,

Quoted 57 lines · Aldrin Martoq

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()

--------------------------------------------------------------------

Quoted 7 lines

I have tried to contact the mantainer of PyAlsaAudio ([email protected] 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

#2 lore raw
Quoted 7 lines · Takashi Iwai

At Fri, 4 Jan 2008 15:01:39 -0300,

Quoted 4 lines · Aldrin Martoq

I have tried to contact the mantainer of PyAlsaAudio ([email protected] 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.

Quoted 7 lines
Quoted 3 lines

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...

I maintain official ALSA pyalsa package. If you port / create a sequencer binding to this tree, I'm sure we can commit it there.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.