sketchbook: supercollider? i just met her!

It took some doing, but I got SuperCollider running a sequenced filter cutoff pattern effect. It actually does a little more than just changing the filter cutoff — it also gates the incoming sound, to get more of a synth arpeggio effect. Here’s a sample, running a cello sound (a soundfont played by Qsynth), with a stereo delay added for good measure:


mp3 | vorbis | 44 seconds

You can check out the code after the jump:

TempoClock.default.tempo = 2; // 120 BPM

SynthDef(\audioinfilt, { |freq = 300, sustain = 1|
  var sig;

  sig = MoogFF.ar(SoundIn.ar(0), freq, 2.5) *
    EnvGen.kr(Env.linen(0.01, sustain, 0.01, 0.7), doneAction: 2);

  Out.ar(0, sig ! 2); // sig ! 2 is the same as [sig, sig]
}).send(s);

a = Task({
  var delta = 0.25;

  loop {
    [100, 800, 8000, 600, 3000, 1000, 150, 300].do({ |cutoff|
      Synth(\audioinfilt, [freq: cutoff, sustain: delta * 0.5]);

      delta.wait;
    });
  }
});

a.play;

The SynthDef defines a synth routine that plays a chunk of audio from the audio inputs, run through a filter, while the Task section defines the pattern, looping through an array of values and kicking off a synth for each value.

Leave a Reply

Your email address will not be published. Required fields are marked *