jacklib problem

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
peter
Established Member
Posts: 13
Joined: Tue Jul 21, 2015 1:48 pm

jacklib problem

Post by peter »

I'm having a problem with jacklib under python.
Connections work like they should.
I do not receive any midi messages. (no error given) the count of messages is always 0.
And can't send midi message (error : parameter 3 is wrong type), so what is the type of parameter 3 ("buffer") ?

Every bit of help appreciated.

My code :

Code: Select all

	
        poortBuffer=None
	timer=None
	uitTimer=None
	uitBuffer=None
	def sendTest():
		global uitBuffer,uitTimer
		ev=jack_midi_event_t()
		print ev._fields_
		
		#res=midi_event_write(uitBuffer, 0, ev._fields_, len(ev._fields_))
		#print res
		#uitTimer=root.after(1000,sendTest)

		
	def getMidi():
		global poortBuffer,timer
		
		leng=midi_get_event_count(poortBuffer)
		#print leng,
		#print poortBuffer,
		if leng>0:
			ev=jack_midi_event_t()
			res=midi_event_get(ev, poortBuffer, 0)
			ptr=ev._fields_[2]
			print ev._fields_[1],ev._fields_[2],ptr
			print translate_midi_event_buffer(ptr)
		lost=midi_get_lost_event_count(poortBuffer)
		if lost>0:
			print "lost",lost
			
			
		timer=root.after(100,getMidi)
	
	from Tkinter import *
				
	root = Tk()	


	# font to use for label widgets
	root.option_add("*Font", "verdana 12")
	klant=client_open("jacklib1",NoStartServer, 0)

	
	poort=port_register(klant, "JL_in", "8 bit raw midi", PortIsInput, 100)
	if poort==None:
			print "port not connected ??"
	else:
			print "port ok"
			poortBuffer=port_get_buffer(poort, 0)
			print "Buffer :",poortBuffer
	
	uitPoort=port_register(klant, "JL_out", "8 bit raw midi", PortIsOutput, 100)
	if uitPoort==None:
			print "port not connected ??"
	else:
			print "port ok",uitPoort
	
	print klant,poort,uitPoort
	res=activate(klant)
	print "activate",res
	timer=root.after(10,getMidi)
	uitTimer=root.after(10,sendTest)

	root.mainloop()
	conn=port_get_connections(poort)
	print conn
	client_close(klant)
Trying is what I do best.
StudioDave
Established Member
Posts: 753
Joined: Sat Nov 01, 2008 1:12 pm

Re: jacklib problem

Post by StudioDave »

peter wrote:I'm having a problem with jacklib under python...
I'm not a developer, but you might want to look at the Python code in Csound, blue, and athenaCL.

http://www.csounds.com/

http://blue.kunstmusik.com/

http://www.flexatone.org/athena.html

Note that Python is *not* used as a realtime audio rendering engine. However, for the generation of MIDI events it's pretty handy, ditto for things like Csound and SuperCollider score events.

And here's one that uses a custom Python engine (pyo) for its audio :

http://ajaxsoundstudio.com/software/cecilia/

Best,

dp
peter
Established Member
Posts: 13
Joined: Tue Jul 21, 2015 1:48 pm

Re: jacklib problem

Post by peter »

@falktx
Thx for the reply.
But it is a bit cryptic. I do not understand why your help would give me more problems. Is jacklib that bad ?

On the topic of using python, i'm not using it for realtime application.
I make midi generators and midicontroller editors with python.
I did read the article from your link on realtime audio, but that's not what I'm doing.
Trying is what I do best.
peter
Established Member
Posts: 13
Joined: Tue Jul 21, 2015 1:48 pm

Re: jacklib problem

Post by peter »

@StudioDave

Indeed, there are enough apps that use python (like mididings).
I think you can easily separate time critical code from non critical code.

I use portAudio for now but want a jack interface, so got my eye on jacklib.
And I want to explore jacklib before trying something else.
Trying is what I do best.
Post Reply