4
\$\begingroup\$

Pure data is a graphical programming language designed for audio processing. This makes it unsuitable for most general programming but especially unsuitable for .

It would then be nice to have a question so that people can get a first foot up in this language.

What tips are there for golfing in Pure Data? Answers should apply specifically to Pure Data.

\$\endgroup\$
2
\$\begingroup\$

Use a text editor

The editor that comes with Pure Data is really useful for making programs that work or helping you to understand existing programs. However if you want to golf, the files it creates are full of extra stuff that can be removed with an text editor (e.g. vim).

This post will serve as a list of a bunch of small byte saving tricks accessible only through or more easily though a traditional editor.

  • Use defaults on canvas: Your file needs a canvas line. #N canvas; is enough to get things to run without error. The missing arguments default to zero.

  • Newlines are optional: The graphical editor puts newlines between statements. Presumably to make these files somewhat readable. However these are not strictly required and can be removed with an editor.

  • Rearrange your objects for better object indices: Since connections identify objects by their order in the source, placing objects with a lot of connections earlier in the file can shorten your source. Make sure that you update all the references once you reorder.

  • Put everything in the top left: Since object location is purely a graphical aid, you can place them wherever. Single digit locations are the shortest so changing the location to 0 0 or something similar will save you. This turns your code into an unreadable blob so it is probably best to do this once everything already works.

\$\endgroup\$
1
\$\begingroup\$

Avoid using triggers to sequence messages

One of the common uses of trigger objects is to make the order of execution clear when a single object is sending messages to multiple places. In those cases, since code readability is not a concern for us, you can depend on Pure Data's default behavior which is to send the messages across connections in the order that the connections were created (or if you are using a text editor, the connection that appears first in the file).

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.