libraries

Processing libraries are extra packages that you can add to your sketch for extra functionality. One of the great advantages of the strong Processing user base is that many libraries have been contributed to the project which offer the end-users (you) endless possibilities for expanding and upgrading their applications.

Processing comes with a handful of core libraries, such as Serial and OpenGL, but all contributed libraries must be downloaded and installed in order to use them. Libraries are packaged in a JAR file and usually come in a directory structure similar to <package-name>/library/<package-name>.jar. This directory tree must be placed in the path/to/Processing/libraries/ folder in order to be recognized by the Processing IDE.

To use a specific library in a sketch, we need to include its classes in our source. The easiest way to do this is to select the appropriate library name from the Processing menu bar under Sketch/Import Library.... This will add an import statement at the top of the code, which tells Processing to look for class definitions in this additional package.

Each package consists of a few classes, each with its specific attributes and methods, much like the Pulse and Soldier classes we have already defined. Most libraries have a webpage with examples and documentation that you should read to make sure you understand how to use them. We will now cover a few libraries and go through simple examples to get started.

The following libraries are also very useful and interesting. Their websites are complete with documentation and examples to get you started.

The following two links are shameless plugs for libraries I have been working on.

Processing Workshop

Elie Zananiri
Alberta College of Art + Design
3-5 April 2008