• jon@schemawound.com
Supercollider
Tweet Deconstruction: 2015-12-31

Tweet Deconstruction: 2015-12-31

I have not posted much about Supercollider latley so I decided to take a couple minutes to break drown a recent tweet I posted.

play{a=SinOsc;y=CombC.ar(Dust.ar(1),1,a.ar(0.01,0,2e-3,3e-3),30,1);z=CombC.ar(y,1,[0.2,0.3],30,1,y);SelectX.ar(a.ar(0.1),[z,z*a.ar(99)])/3}

The first thing to do is to add some white space for readability. I also wrap the whole thing in parenthesis so it can still be executed as a single statement.

(
play{
	a=SinOsc;
	y=CombC.ar(Dust.ar(1),1,a.ar(0.01,0,2e-3,3e-3),30,1);
	z=CombC.ar(y,1,[0.2,0.3],30,1,y);
	SelectX.ar(a.ar(0.1),[z,z*a.ar(99)])/3
}
)

In order to save space when I wrote the tweet I made “a” point to SinOsc. Let’s undo that now for a little more clarity

(
play{
	y=CombC.ar(Dust.ar(1),1,SinOsc.ar(0.01,0,2e-3,3e-3),30,1);
	z=CombC.ar(y,1,[0.2,0.3],30,1,y);
	SelectX.ar(SinOsc.ar(0.1),[z,z*SinOsc.ar(99)])/3
}
)

The meat of the sound is generated by creating a very short delay with a long decay time being feed a series of random impulses.

play{CombC.ar(Dust.ar(1),1,0.015,30,1)}

The delay time is modulated by a slow sine wave LFO in order to give the slow bend sound to the piece

(
play{
	var dlyLFO = SinOsc.ar(0.01,0,2e-3,3e-3);
	CombC.ar(Dust.ar(1),1,dlyLFO,30,1)
}
)

To make this even more readable I have removed the mul and add params and instead call the range method on the LFO.

(
play{
	var dlyLFO = SinOsc.ar(0.01).range(0.003, 0.007);
	CombC.ar(Dust.ar(1),1,dlyLFO,30,1)
}
)

Next we use put a longer delay with a long decay time to fill up our soundscape. The delay time is given as an array to cause our delays to be different in the left and right channels.

(
play{
	var dlyLFO = SinOsc.ar(0.01).range(0.003, 0.007);
	var string = CombC.ar(Dust.ar(1), 1, dlyLFO, 30, 1);
	CombC.ar(string, 1, [0.2,0.3], 30, 1, string);
}
)

The SelectX command is crossfading between a clean and an amplitude modulated version of our signal. We divide the final results by 3 in order to lower the volume and avoid clipping.

(
play{
	var dlyLFO = SinOsc.ar(0.01).range(0.003, 0.007);
	var string = CombC.ar(Dust.ar(1), 1, dlyLFO, 30, 1);
	var echo = CombC.ar(string, 1, [0.2,0.3], 30, 1, string);
	SelectX.ar(SinOsc.ar(0.1), [echo, echo * SinOsc.ar(99)]) / 3;
}
)

After the last line is rewritten for readability we have our final result.

(
play{
	var dlyLFO = SinOsc.ar(0.01).range(0.003, 0.007);
	var string = CombC.ar(Dust.ar(1), 1, dlyLFO, 30, 1);
	var echo = CombC.ar(string, 1, [0.2,0.3], 30, 1, string);
	var echoAM = echo * SinOsc.ar(99);
	var select = SelectX.ar(SinOsc.ar(0.1), [echo, echoAM]);
	select / 3;
}
)

In the comments of the Soundcloud post Fredrik Olofsson pointed out that the tweet could be shortened by 8 charecters

play{a=LFCub;SelectX.ar(a.ar(0.1),[z=CombC.ar(y=CombC.ar(Dust ar:1,1,a.ar(0.01)*2e-3+3e-3,30,1),1,[0.2,0.3],30,1,y),z*a.ar(99)])/3}