Project: p5_sc: SuperCollider for Processing

Processing.org classes for interfacing with the SuperCollider synthesis engine.

version: 0.2.3
title: p5_sc
platform: Processing
license: GPLv2
created: 2007/10

Download (zip, 24KB)

This library is an implementation of many of the core elements of SuperCollider's client-side language. It provides analogous objects to encapsulate common functions (creating and manipulating Synth, Buffer and Bus objects, for example), and simplifies the task of interfacing with SuperCollider's powerful synthesis engine.

Examples

Development of this library was driven by AtomSwarm, a generative, interactive audio/video work which makes heavy use of both SuperCollider and Processing. Watch a video here (YouTube).

Installation

Now open a new sketch, and the Import Library menu should include an entry for 'supercollider'. To get started, run the sample code below, or browse the class documentation.

Helper functions

A series of helper functions are also available which provide frequently used client-side operations (mapping between parameters, clipping values, MIDI/frequency conversion, non-uniform random number generation).

Usage (SuperCollider)

SynthDef(\sine, { |amp = 0.5, freq = 440|
	var data = SinOsc.ar(freq, 0, amp);
	Out.ar(0, data ! 2);
}).store;

Usage (Processing)

import supercollider.*;

Synth synth;

void setup ()
{
    size(800, 200);

    // uses default sc server at 127.0.0.1:57110    
    // does NOT create synth!
    synth = new Synth("sine");
    
    // set initial arguments
    synth.set("amp", 0.5);
    synth.set("freq", 80);
    
    // create synth
    synth.create();
}

void draw ()
{
    background(0);
    stroke(255);
    line(mouseX, 0, mouseX, height);
}

void mouseMoved ()
{
    synth.set("freq", 40 + (mouseX * 3)); 
}

void stop ()
{
    synth.free();
}

Changes

Creative Commons License

Valid XHTML 1.0 Strict Valid CSS 2