PureData py/pyExt into standalone python
Eric_Dexter at msn.com
Mon May 25 07:13:34 CEST 2009
On May 23, 6:49 am, responsib... at gmail.com wrote:
> Hi guys,
> Short version:
> I've written some python classes for py/pyExt extensions for the
> "dataflow" graphical programming environment PureData. Here's an
> example PureData screenshot for clarity:
> My classes talk to eachother via the PureData system, and they talk to
> the outside world via pyPortMIDI (which enables raw MIDI data
> PureData encourages modularisation, so I've written several classes:
> * some that receive raw MIDI data,
> * some that parse this into human-readable tokens,
> * some that just generate human-readable tokens,
> * and some that parse human-readable tokens then send raw MIDI data
> I want to join these together as a stand-alone python application,
> using internal python communication instead of PureData...
> ...but I don't know how to do this. The only python I know comes from
> writing using the pyExt API, and the PureData API (which is written in
> Long(er) version:
> Miller Pukette's PureData:http://puredata.info/
> Thomas Grill's Flext:http://puredata.info/Members/thomas/flext
> Thomas Grill's Py/Pyext:http://puredata.info/Members/thomas/py/
> John Harrison's PyPortMIDI:http://www.media.mit.edu/~harrison/code.html
> CMU's PortMIDI:http://www.cs.cmu.edu/~music/portmusic/
> PureData is a graphical "dataflow" programming environment that (among
> many, many other things!) allows for very rapid development of Audio
> and MIDI processing. Objects in PureData (and MaxMSP) communicate by
> sending messages through "patch cords" that connect an "outlet" to an
> "inlet" of another object.
> Thomas Grill's py/pyExt allows python code to be embedded as a
> PureData object. The benefit being that this python code can be
> effortlessly ported across multiple platforms (win32/linux/osx) and
> also to the highly related (but more commercial) Cycling'74 MaxMSP
> system. (PureData object code is written in C and generally not easy
> to port between platforms, nor between PD and MaxMSP - so writing
> portable python objects is a boon!)
> a pyExt object sends messages from its outlets using the line:
> a pyExt object performs actions when a message arrives at an inlet. An
> integer arriving at inlet 1 could be attached to this method code:
> def int_1(self,*arg):
> print "received integer:",arg
> If these pieces of code were in separate python classes - how would I
> connect two objects together such that an integer was passed between
> the two?
> If the first object sent 42, in puredata it would look like this:
> useless fact: the screenshot doubles up (i.e. "pyext sender sender")
> due to the first word being the python file (i.e. sender.py), whilst
> the second is the name of the object class (i.e class sender
> Maybe a more tricky question is:
> PureData supports "message busses" - messages sent to named busses can
> be broadcast to multiple locations. How would I connect objects up in
> this way using python?
> a pyExt object registers to receive messages on a certain bus using:
> def method_to_call(self,*arg):
> print "a message on", bus_name, "arrived"
> print "the message was", len(arg), "long"
> print "and had the values", arg, "inside"
> a pyExt object sends messages to a particular bus by using:
* some that parse this into human-readable tokens,
* some that just generate human-readable tokens,
This might be usefull do you intend to release this code??
There are some midi libraries that may be helpful, it is hard to tell
what you need without seeing the code
More information about the Python-list