[PD] seperate GUI communication protocol?

Mathieu Bouchard matju at artengine.ca
Mon Sep 12 21:22:26 CEST 2005


On Fri, 9 Sep 2005, Jelle Herold wrote:

> I am trying to remove the Tk gui from pd and use it just as an engine
> and do the patch editing programatically, i.e. replace the GUI by a
> (python) program.

Join the DesireData project!
(formerly known as ImpureData)

We are trying to do that client-server separation and model-view 
separation, with the view being in the client and the model being in the 
server, using a system that automatically copies attributes from model to 
view through an observer-observable relationship.

Even though our new GUI is still based around Tcl/Tk, we are decoupling 
the client and the server, which will cause the protocol to become slimmer 
and much more data-oriented than appearance-oriented.

> Reading through the pd sourcecode it seemed to me that the Tk gui is
> seperated from the pd core and communication takes place through a
> socket. Is this right, or am I completely off?

in regular pd, almost all of the view code lies in the server, which ends
up micromanaging the client, doing essentially all the job of the client. 
It's not that much better than having Tcl/Tk being hosted inside of Pd 
itself.

> If so, is this the best way to control pd programmatically? And is this
> protocol documented somewhere?

The client-to-server protocol is like [netsend]/[netreceive].

The server-to-client protocol is Tcl code.

This is not changing in DesireData, but the actual content of the 
transmissions does change: e.g. in the latter, the server does not send 
any Tk-specific commands, and barely even uses Tcl commands.

I also have a plan of modifying the syntax of Pd slightly so that it looks
more like Tcl. It will make it much more powerful yet about as easy to
parse. This isn't really creating a dependency on Tcl because Tcl is among
the easiest languages to parse. Examples of easy-to-parse languages are:

 * Lisp and Scheme and Tcl (nested list syntax).

 * Forth and PostScript (stack-oriented syntax, alias "RPN"), 

 * Smalltalk and Self (object-oriented subject-verb-complements).

 * MAX and PureData (but it's missing nested lists! what???).

What I want is PureData syntax minus the current behaviour of backslash
plus those constructs from Tcl: doublequotes, braces, backslash. There
will still be some major differences between Tcl and the new Pd format,
the biggest being that Pd distinguishes between float and symbol at the
lexical analysis level (and in the spirit of that, the new syntax will
also make string and nested-list distinct atom types at the lexical
analysis level too).

It should be easy to write (in most any language) a recursive-descent
parser for Tcl and/or the new Pd syntax, in less than 100 lines of code
(unless you like to put a lot of whitespace in your code).

> Or where should I look in the sourcecode?

Download it using CVS : http://sourceforge.net/cvs/?group_id=55736

You should insert "-r devel_0_39" without the quotes, just after the 
"checkout" keyword.

That will be a few hours behind the actual up-to-date devel_0_39. If you 
want that one, you will have to register for a developer's account at 
sourceforge.net.

If you want upload permissions you need both the account and to ask for a 
developer account on pd-dev. It's highly recommended that you subscribe to 
pd-dev : http://lists.puredata.info/listinfo/pd-dev

In devel_0_39, you have the code of both the regular Pd GUI and the
DesireData GUI. You can select the one you want using "scons desire=yes
install" (to get back to the regular GUI, use "scons desire=no install").
You should have the SCons compilation management software installed, as
well as the GCC compiler (just the C part, no need for the C++ part). You
will _not_ need "Make" nor AutoConf nor AutoMake for that.

To start DesireData, do not run "pd". Instead run "wish desire.tk" from
the "pd/src" directory. You should have realtime disabled by using -nrt in
~/.pdrc because desire.tk doesn't have a watchdog yet. If you don't have 
the GDB debugger you will have to write "wish desire.tk -nogdb" instead. 
I recommend compiling with "debug=yes wall=yes".

Currently, DesireData is not usable at all, but most of the required code 
is already there, so progress will be quick, as it's mostly a matter of 
putting things together.

> If not, what would be the best way to remove the Tk gui from pd? Again
> maybe someone can point me at the right place to start digging in the pd
> sourcecode.

Join our team:
  Mathieu Bouchard (matju)
  Chun Lee (chun)
  Carmen Rocco (changes nickname every week or so)

We mostly meet on IRC on the #dataflow channel of the irc.freenode.net 
network.  

The project originally ran February-May 2004 as a separate branch "-r
impd_0_37". Chun Lee and I restarted it last month with a new name. In the
meanwhile Carmen has made experiments using Toxy and TkZinc and such.

> Finally, is there some general document on the pd software architecture
> / implementation?

no.




PS: Those who find the name desiredata cheesy should reverse the "red"  
part in order to get a nice word in latin. (it is also in English
dictionaries such as m-w.com)

____________________________________________________________________
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
Freelance Digital Arts Engineer, Montréal QC Canada




More information about the Pd-list mailing list