You are on page 1of 17

1

SESSION

SuperCollider

.
(object oriented).
, (client)
(server). T server .
SuperCollider
.
SuperCollider.boot;
{goto http://supercollider.sourceforge.net/

download. SuperCollider3.6.2

install.SuperCollider3.6.2

run.SuperCollider3.6.2}

SESSION

//Notes

supercollider . scsynth (server) sclang ( ). scsynth


C
supercollider interpreter post buffer (post window)
sclang.


supercollider C++
Java Smalltalk.
. Integer
String .
Function.
.

. ,
.
. Object.message .
.
SinOsc .ar audio rate (SinOsc.ar).
2 .squared
(2.squared).

SESSION

//
. interpreter
Arguments ()

.
SinOsc .ar arguments . to
freq, phase, mul, add ( .. SinOsc.ar(freq:250, phase:0, mul:1, add:
0) SinOsc.ar(freq: 2000, phase: 1, mul: 2, add: 0) ).
Variables ()


. 2.squared
~a = 2 ~a.squared. supercollider
. =
.

~ .
x = 10
s i. s
~s. Help Environment.
To
.

SESSION

UGen (UnitGenerator)
SinOsc (Sine Oscillator) UGen. UGens
. UGens
audio rate control rate. audio rate
control rate .
Synth
Synth UGens
. o Synth UGens
(audio control rate) Bus.

us

To Bus . Bus audio rate


audio control rate

SESSION

Function
{} Function.
{arguments; statements;} ( {statements;}).
Function .
~add = { 3 + 4; };.
.value, ~add.value; .

~add = {arg a = 3, b = 4; a + b; };. arguments
~add.value(a: 5, b: 5); ( ).
.play function
Synth ( !).
Synth .
Synth SinOsc argument
freq mul, Synth ~synth1 (
).
~synth1 = {arg freq = 330, mul = 1; Out.ar(0, SinOsc.ar(freq,
0, mul, 0))}.play;

~synth1.set(\freq, 400, \mul, 2);

SESSION

Modulation
control rate Bus argument Synth
control rate Bus.
~lfoBus = Bus.control;
control Synth ~lfoBus.
~lfoSynth = {

arg lfoFreq = 2, lfoAmp = 20;

Out.kr(~lfoBus, SinOsc.kr(lfoFreq, 0, lfoAmp, 200))
}.play;
argument freq ~lfoBus.
~synth1.map(\freq, ~lfoBus);

SESSION

//Code

SESSION

SESSION

//Notes
function, global
~synth1, function (arguments), freq
() mul ().
Out,
(bus),
. 0,
.
Out, SinOsc,
. freq mul
, phase add,
SinOsc.
function ~synth1, scope,
function
- .

~synth1 = {arg freq = 330, mul = 1;


Out.ar(0, SinOsc.ar(freq, 0, mul, 0))
}.scope;

SESSION

SynthDef.
sine
.
Elvelope,

.

.perc = percussion
.
doneAction: 2,
, .
.

EnvGen.ar(Env.perc, doneAction: 2);

SESSION

SynhtDef function
,
, .
, ~s1 ~s2
(~s1 = Synth(\sine) ~s2 = Synth(\sine)),
.set (~s1.set(\freq, 200)),
~s1, 330Hz
SynhtDef 200Hz.

SynthDef(\sine, { arg freq = 330, mul = 1;


var env;
env = EnvGen.ar(Env.perc, doneAction: 2);
Out.ar(0, SinOsc.ar(freq, 0, mul, 0) * env)
}).send(s);

~s1 = Synth(\sine);

~s2 = Synth(\sine);

~s1.set(\freq, 200);

SESSION

SynthDef (arg),
Ugens , SinOsc
LFPulse.
,
SynthDef. ,
SinOsc
SynthDef.
AM (Amplitude Modulation)
, ,
.
(carrier)
(modulator).
modulator
SinOsc. (carriers) , LFPulse
SinOsc.

SESSION

SynthDef(\sound_1, { arg freq = 330, lphase = 0,



lwidth =0.3,lmul = 1, ladd = 0, modfreq = 2,

modphase = 0, modmul = 0, modadd = 0, rls = 1;

var source, modulator, env;


modulator = SinOsc.kr(modfreq, modphase, modmul,
modadd).abs;

source = [LFPulse.ar(freq, lphase, lwidth, lmul +
modulator, ladd), SinOsc.ar([freq, freq/2],

lphase, lmul + modulator, ladd)];

env = EnvGen.ar(Env.perc(releaseTime: rls),
doneAction: 2);

Out.ar(0, source * env)

}).send(s);

SESSION


arguments
SynhtDef.

~s1 = Synth(\sound_1, [\freq, 100]);


~s1 = Synth(\sound_1, [\freq, 100, \rls, 0.3,
\lwidth, 0.5]);

~s1 = Synth(\sound_1, [\freq, 100, \rls, 4,
\lwidth, 0.5, \lmul, 0, \modmul, 0.3]);

~s1 = Synth(\sound_1, [\freq, 100, \rls, 4,
\lwidth, 0.5, \lmul, 0, \modmul, 1,
\modfreq, 4, \modadd, 0.5]);

SESSION

SynthDef,
FM (Frequency Modulation) ,
,
.

.
.
MouseX
MouseY, ,
,
.

SESSION

SynthDef(\sound_1, { arg freq = 330, lphase = 0, lwidth =



0.3, lmul = 1, ladd = 0, rls = 1, modfreq = 3,

modmul = 100, modadd = 50;

var source, env;


source = [LFPulse.ar([freq, freq* 1.5, freq*2] +
SinOsc.kr(modfreq, 0, modmul, modadd).abs, lphase,
MouseY.kr(0.5, 0.9), MouseX.kr(0, 2), ladd),

SinOsc.ar([freq, freq/2] + SinOsc.kr(modfreq, 0,

modmul, modadd).abs, lphase, MouseX.kr(0, 2), ladd)];

env = EnvGen.ar( Env.perc(releaseTime: rls), doneAction:2);

Out.ar(0, source * env)

}).send(s);

SESSION

~s1 = Synth(\sound_1, [\freq, 100, \rls, 100])


~s1.set(\modfreq, 0.025);

(
~s1 = Synth(\sound_1, [\freq, 10000, \rls, 1, \modfreq,
0.2]);
~s2 = Synth(\sound_1, [\freq, 100, \rls, 1, \modfreq,
0.025]);
)
~s1 = Synth(\sound_1, [\freq, 100, \rls, 100]);

You might also like