Context Navigation

What is Packet Forth?

Packet Forth is an open source scripting language for artists and programmers interested in generative art, animation, audiovisual performances, installations, visualisation systems... Packet Forth is used for rapid prototyping, research and professional production. It's a 'high level' Forth dialect: it uses data types (floats, ints, symbols, strings, lists and trees) and packets. It is easy to learn, even if you have no prior experience with programming.

Features

type system tailored to 'pure data packets' (i.e. video images)

scripting language based on Forth, with some built in high level
extensions (exceptions, different types, polymorphy in the form of generic functions, ...)

lots of interoperability features (streams & inferior processes)

opengl bindings

fast image processing code

can run as a Pure Data plugin

easily extended using a simple plugin system

Packet Forth currently runs on linux and OSX

Glue

One of the goals of Packet Forth is to serve as a 'media glue language'. There are a lot of ways to connect to other programs or objects:

Connect to Pure Data by writing a small pf script that will implement a pd object's behaviour

Execute Unix commands from within PF

Packet Forth supports streams. These can be files, sockets, fifos or the input/output of inferior processes. Load and save packet data in the native format is supported for all streams.

Packet Forth interfaces easily with lisp dialects due to its similar 'read' and 'write' syntax.

Packet Forth is an application and a programming language, packaged as a library to ease integration in other systems. Currently there are 2 operational interfaces: as a unix command and as a puredata object. Although it runs like an application, it is actually a programming language. The application core is written in C, and can be used in programs that have a C language binding. Most of the core functions are available as primitives in a language based on Forth. These primitives can be used to build things related to media processing.

Why forth?

Because it's short and simple. Forth is combinatorial which means that data is not accessed by name, but by position. This brings the focus to processors (operators) instead of data objects (operands), making it resemble data-flow languages like Pd, although in a non-graphical fashon.

If you have previous programming experience, the fact that arguments passed between functions are not named might feel strange at first. However, after the first 'aha', which usually takes about an hour, this sacrifice starts to pay off, as you gradually start to think about operations instead of results.
On a more technical level: because forth uses stacks and is very 'linear', memory management based on reference counts can bring you very far. i.e. you don't need a general purpose garbage collector. This is ideal in a video-processing setting where a lot of memory is used.