It's just a hack. For more serious solutions see [[http://mccormick.cx/projects/PyPd/][PyPd]] and [[http://code.google.com/p/pyata/][PyATA]].
#+begin_src sh
$ sudo aptitude install puredata
$ sudo aptitude install python
#+end_src
- Installation
Download the latest ->pd version at github.com:
#+begin_src sh
$ git clone git://github.com/automata/topd.git
$ cd topd
#+end_src
#+begin_src sh
$ pd receive.pd &
#+end_src
Run your Python interpreter:
#+begin_src sh
$ python
#+end_src
Import ->pd:
#+begin_src sh
from topd import *
#+end_src
Create a "virtual" patch (a connection to receive.pd patch):
#+begin_src sh
p = Patch('receive.pd', 'localhost', 4242)
#+end_src
Create some PD objects:
#+begin_src sh
osc = Object(p, 'osc~ 440')
#+end_src
You can optionally specify x, y position of the object in the patch:
#+begin_src sh
dac = Object(p, 'dac~', 100, 200)
#+end_src
Connect them (note the use of inlets/outlets numbers):
#+begin_src sh
osc.connect(0, dac, 0)
osc.connect(0, dac, 1)
#+end_src
Turn on the DSP:
#+begin_src sh
p.dsp(True)
#+end_src
Disconnect them:
#+begin_src sh
osc.disconnect(0, dac, 0)
osc.disconnect(0, dac, 1)
#+end_src
Delete them:
#+begin_src sh
osc.delete()
dac.delete()
#+end_src
Hack free and enjoy!
For a complete description of all ->pd functions see the API documentation at
http://automata.cc/wiki/uploads/Main/topd.html