Supercollider

From Noisebridge
Revision as of 13:23, 24 March 2016 by SteeleNivenson (talk | contribs) (what sc does)
Jump to navigation Jump to search

Introduction

Supercollider (SC) operates in the same vein as the bytebeat project but at a higher level. The computer music workstation has SC installed.

Example code

The following is an algorithmic composition in the SC language by Fredrik Olofsson, published on Twitter. It must be executed in the SC virtual machine.

play{a=LFCub;Splay.ar(a.ar(b=2/(2..9))%a.ar(b/5)*a.ar(2**a.ar(b/8)>0+1*2*(b*[300,303]-(a.ar(b/9)>0*50).lag2))*a.ar(b/6,b))}

This is not a limitation of the language though. It can be written in a much more expressive way, and lends itself to livecoding as a performative activity.

For example, the following creates a synth definition, followed by four instances of that synth with different parameters. Each code block can be executed as a piece, and the engine runs the code blocks in realtime.

// Define a single synth that takes parameters
SynthDef.new("impulse-sinefunc", { |
	impulseLFO = 0.49,
	panPos = 0.5,
	lfoRange = 833,
	sinFreq = 435 |

	Out.ar(0,
		Pan2.ar(
		Decay2.ar(
			Impulse.ar(
				LFCub.kr(1,0.33,1,impulseLFO),
				0
			),0.09,0.4,SinOsc.ar(sinFreq,0,0.25,0)
		),panPos)
	)}
).add;

// mess around with these four starting at different times
x = Synth.new("impulse-sinefunc",[\impulseLFO,5.5,\panPos, 0.2, \sinFreq, 457]);
x.free;
y = Synth.new("impulse-sinefunc", [\impulseLFO,5, \panPos, 0.7]);
y.free;
z = Synth.new("impulse-sinefunc", [\impulseLFO,4, \panPos, 0.3,\sinFreq, 488]);
z.free;
a = Synth.new("impulse-sinefunc", [\impulseLFO,4.2, \panPos, 0.8,\sinFreq, 444]);
a.free;

Facts