Skip to content

Project 1

Once you install Python and py4pd, the simple way to use Python inside PureData is by .py files. You must organize your work as

├─ PROJECT_FOLDER
├── myscript.py
└── mypatch.pd

Inside mscript.py you must define some Python function. Let's say:

def mysum(x, y):
    return x + y

After define the mysum function, you can load using py4pd myscript mysum ([py4pd <script> <function>]). To execute, send the message run, with the arguments (in this case two numbers).

You can also use lists, to do that define some function with list:

def mylistsum(x):
    return sum(x)

And after that you can use [py4pd myscript mylistsum] to load the object and add the list using [ and ].

Warning

We don't use , between the list items.