pyext for Pure Data

POSTED BY niklas on Nov 22 under Music/Technology

I decided I prefer writing normal logic in a language I’m used to, so I went looking for a Python-external for Pure Data. And sure enough, I found Thomas Grill’s py/pyext (built upon flext, a C layer for Python externals). I didn’t figure out how to install the binaries (didn’t take the time to experiment) so I just compiled them up. Works great. :-)

Writing externals for this is supersimple:

class example(pyext._class):
  _inlets=2
  _outlets=1

  def _anything_1(self,args):
    print "inlet 2:",args
    self._outlet(1,1)

  def _anything_2(self,args):
    print "inlet 2:",args
    self._outlet(1,2)

This little code should be an external that prints out the argument it receives and sends the inlet number it received the signal on to the outlet.

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

2 Comments so far
  1. Phil October 10, 2007 4:06 am

    Hi,

    Is it possible to write externals that make function calls in python?

    In other words, can you communicate with a driver using python code?

    Phil

  2. niklas November 30, 2007 4:50 pm

    Haven’t tried with a driver, but anything you can do in Python you should be able to do through an external. For DSP work I suppose there is a real-time criteria, though :-)

Copyright Niklas Saers, 2000-2008