Project: SuperCollider client for Processing

A Processing library to interface with the SuperCollider synthesis engine.

version: 0.3.1
title: SuperCollider client
platform: Processing
license: GPLv2
created: 2007/10
modified: 2012/01

Download (zip, 88KB)

This library provides a simple approach to interfacing with the powerful SuperCollider sound synthesis engine. It provides objects to encapsulate common functions such as creating and manipulating Synth, Buffer and Bus objects.

Formerly known as p5_sc, now renamed for the release of Processing 2.0.

Example works

Installation

The latest code can be found at github, with a snapshot available here.

  • Install the oscP5 library
  • Download and unzip SuperCollider Client for Processing, and copy the 'supercollider' directory into the libraries folder of your Processing sketchbook (details)

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.*;
import oscP5.*;
import netP5.*;

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 exit ()
{
    synth.free();
    super.exit();
}

Changes

  • v0.1 2 November 2007
    Initial release.
  • v0.2 4 November 2007
    Support added for asynchronous commands and object/target handlers.
  • v0.2.1 5 November 2007
    New methods added to Buffer: set(), setn(), get(), getn().
  • v0.2.2 6 November 2007
    New methods added to Buffer: zero(), fill().
    New example code.
    Server.init() added to prevent run-time delay when class is first loaded
    (thanks to Manfred Brockhaus)
  • v0.2.3 10 November 2007
    Synth.set() expanded to support multiple parameters in a single bundle.
    Support added for server.latency.
  • sc_utils.java 13 February 2008
    sc_utils helper functions added.
  • v0.3.0 27 November 2011
    Updated for Processing 2.0.
    Fixed outdated examples.
    Buffer.cueSoundFile() added for streaming audio via DiskIn
    (thanks to Antoine Schmitt)
  • v0.3.1 8 January 2012
    Updated for oscP5 0.9.8.