Processing for Kids : Part 2

Setup and Draw.
Teaching a 12-Year Old to Do Something Creative with Processing.
By JD Pirtle.

Part Two: Working with Sound

We started this week’s session with Elonzo by discussing how to create original assets. The fact that Elzono is 12 means that we can’t just sit down to the Processing IDE every week and bang out code for the entire two-hour session, like we could with a BFA student frantically debugging their thesis piece at the 11th hour. I think that would be frustrating and could potentially turn him off of ever writing another line of code. Also, although this might be overlooked by seasoned digital artists, basic techniques of recording sound, scanning images and shooting video are skills that every artist working in digital media should have mastered at some point in the novice stage of their practice. Elonzo isn’t in a four-year BFA program in computational art, so we will just introduce the most basic techniques in those areas.

Today we started with sound.

The logical place to begin with sound and Processing is with the built in Minim library. Minim was created by Damien Di Fede “to make integrating audio into your sketches as simple as possible while still providing a reasonable amount of flexibility for more advanced users.” The Minim library is included in Processing and is indeed very simple to use.

Before we got into using Minim in Processing, we rounded up some recording gear and a few sonically promising objects and went into our recording booth here at the lab. We set up a small digital recorder, hit ‘record’ and asked Elonzo to shake sheets of plastic, bang on boxes and tap water pipe ends. Since we weren’t after specific sounds for specific events in our sketch, I thought it would be a good demonstration of using found objects to make interesting sounds. From here, we grabbed the SD card from the digital recorder and sat down to learn about another great open source tool, Audacity . Audacity is a free and open source sound editor and recorder, and has tons of features. Thus far, we’ve only introduced free and open source tools to Elonzo (although he’s been working on a non-free/open source operating system, Apple OSX). The motivation for this isn’t political as much as it is practical—we hope that he’ll be able to continue his exploration of creative programming after the mentorship ends, so learning free and open source tools seems more profitable for him than learning to box model in Maya.

Working with Audacity.

Once we covered how to open Audacity and import his sound files, I went over the process of trimming the beginning/ends off of each waveform. I showed him how applying a few simple effects to the sounds could drastically alter their mood and personality. Lowering the pitch and altering the speed of the recording of Elonzo banging on a box made a deep and resonant “boom.” Reversing and increasing the pitch of the sound of Elonzo shaking a sheet of plastic transformed it into a high, flittering sound reminiscent of a phaser blast or mosquito. The pipe end was surprisingly resonant and bell-like, so we simply trimmed it. After processing the sounds, we exported them and then showed Elonzo the handy trick of dragging the sound files into the Processing IDE, which adds them to the ‘data’ folder in the sketch folder. This led to a brief discussion of the ‘data’ folder, which was a good time to segue into using Minim.

I planned on introducing both the basic features of Minim and working with keyPressed() events in Processing. Elonzo and I opened the “LoadSample” example in Examples>Libraries>Minim Audio, and we also opened up a new sketch. At this point, it would be good to acknowledge that there is a lot of opposition to learning to program or write code by cutting and pasting , but I have found that I have benefited from grabbing bits and pieces of example code for very basic things, particularly during the beginning stages. For our purposes, we went line-by-line through the things we needed from the example and pasted them into our new sketch (after running the example and talking about what was happening there).

Since Minim is a class, at this point we reached a dilemma—should we:

(a) Go into object-oriented programming this early in Elonzo’s first few weeks of exploring creative programming, assuming that a 12-year old’s brain is more elastic and can more easily accept the concepts behind OOP.

(b) Treat the Minim class as a sort of black box, only exposing Elonzo to the key aspects he needs for now, in an attempt to not prematurely overload him with complexity.

We opted for option b. Since the goal was to get an interactive sketch that featured sounds and visuals triggered by keyboard events, this seemed like the most efficient approach. Also, it could be argued that there are several learning stages that one must complete before diving into OOP. For me, it came naturally; at the moment that I needed the functionality for the project I was working on, I grew into it. When I did need to explore OOP, I used Daniel Shiffman’s excellent tutorial.

We added some visual events to punctuate what was happening, and the sketch we came up with was as follows:

import ddf.minim.*;

Minim minim;

AudioSample bell;
AudioSample bug;
AudioSample steps;

void setup() {
  	size (600, 600);
  	minim = new Minim(this);
  	bell = minim.loadSample("bell.wav");
  	bug = minim.loadSample("bug.wav");
  	steps = minim.loadSample("steps.wav");

void draw() {

void keyPressed() {
  	if ( key == 'a' ) {
    		fill(255, 15, 5);
    		ellipse(width/2, height/2, 200, 200);
  	if ( key == 's' ) {
    		fill(0, 25, 255);
    		rect(width/2, height/2, 400, 400);
  	if ( key == 'd' ) {
  		fill(33, 255, 75);
  		rect(100, 100, 200, 200);
  		fill(255, 200, 100);
  		ellipse(100, 100, 100, 100);

void stop() {
  // always close Minim audio classes when you are done with them

This accomplished all of our goals for this week’s session—how to record and process original sound content, how to get started with sound in Processing, and how to work with keyboard events. It also sets the stage nicely for the next session, in which we will be doing some drawings that we scan, process with Gimp and then use in Processing. After going line by line through our sketch, (aside from the OOP aspects) Elonzo displayed a great deal of comprehension about what was happening and customized his sketch to have unique visual events and keys. We are getting closer to a firm idea for his Discovery Night project, so that should materialize quickly over the next few weeks.

>>> Read Part 3

Teaching & article by JD Pirtle.
I feel that artists should lead humanity through the creation and utilization of the most current and yet-to-be-invented technologies and processes