Saturday, May 9, 2009

Guitar effects

I've concentrated mostly on synthesis so far with my SuperCollider experiments, but today for a change I've been trying out some audio prosessing with a live input, my guitar.

To get a Mic or line input in SC you have several options, but using a SoundIn Ugen seems to be the easiest. SoundIn is a wrapper for the standard In Ugen, but it makes thigs easier by offsetting the bus index so that the first audio input is always 0. Setting up audio in in SuperCollider can be a bit of a chore, so check the help file if you can't fathom how input works.

Let's start with distortion, there's loads of ways of doing this,


{SoundIn.ar(0).fold2(0.3)}.play

using fold2 works well, as does clip

{SoundIn.ar(0).clip2(0.3)}.play

and there's also the obviously titled distort

{SoundIn.ar(0).distort}.play

The effect of this sems to be fairly subtle though. Making better use of it is this SynthDef, which comes from the Pfx help file, last used with my drum machine.

SynthDef(\distort, { arg out=0, pregain=40, amp=0.2, gate=1;

var env;

env = Linen.kr(gate, 0.05, 1, 0.1, 2);

XOut.ar(out, env, (SoundIn.ar(out, 2) * pregain).distort * amp);

}, [\ir, 0.1, 0.1, 0]).store;



You'll need to use a line like this to set the synth up.

a = Synth(\distort, addAction:\addToTail)

and if you're feeling like Alec Empire you can't beat a bit of bitcrushing for uttlerly insane fuzz.

{Decimator.ar(SoundIn.ar(0), 10000, 1)}.play



FreeVerb is an excellent choice for reverb,

{FreeVerb.ar(SoundIn.ar(0).distort)}.play


but something like flange is more difficult. This example is taken from the ixi-audio tutorial from ixi-audio.com, very slightly adapted to fit my audio input busses.

A flange effect adds a continually varying delayed signal to the original creating a phasing effect. The AllpassL in this case is the delay, with the LFpar UGen controlling the delay time, which is then mixed with the original input.



*/



(
SynthDef(\flanger, { arg out=0, in=0, delay=0.1, depth=0.08, rate=0.06, fdbk=0.0, decay=0.0;

var input, maxdelay, maxrate, dsig, mixed, local;
maxdelay = 0.013;
maxrate = 10.0;
input = SoundIn.ar(in, 1);
local = LocalIn.ar(1);
dsig = AllpassL.ar( // the delay (you could use AllpassC (put 0 in decay))
input + (local * fdbk),
maxdelay * 2,
LFPar.kr( // very similar to SinOsc (try to replace it) - Even use LFTri
rate * maxrate,
0,
depth * maxdelay,
delay * maxdelay),
decay);
mixed = input + dsig;
LocalOut.ar(mixed);
Out.ar([out, out+1], mixed);
}).load(s);
)




After evaluating that SynthDef you'll need to set up an instance of the synth and set the audio in like this,

a = Synth(\flanger, [\in, 0], addAction:\addToTail)

you can then set the various parameters of the effect like this.


a.set(\delay, 0.04)
a.set(\depth, 0.04)
a.set(\rate, 0.01)
a.set(\fdbk, 0.08)
a.set(\decay, 0.01)

.

2 comments:

  1. those are some cool effects. thanks for posting them. do you know of any other cool ones?

    ReplyDelete
  2. I guess this info is totally unique.
    ug

    ReplyDelete