5. BootServer/SinOsc/Defaults

1. Boot server

UGen을 실행하려면 : boot button을 이용하여 서버를 시동시키거나,
다음의 코드를 이용하여 부팅한다.

Server.default = Server.internal.boot;

play는 localhost와 작동되며, scope는 internal server와 작동된다. (play와 scope는 message code)
지금은 internal server를 default로 사용할것이다.

//—————————————————–
2. SinOsc
;Sinewave generator.

{SinOsc.ar}.play//실행위해 enter, 중지위해 CMD+.
{SinOsc.ar}.scope//scope로도 보여줌.

UGen은 이전에 설명했듯이 .ar, .kr와 같은 message를 사용하여 play한다.

SinOsc에 대한 정보를 보려면, SinOsc를 마우스로 활성화 시킨후 CMD+?를 누른다.
그러면 다음과 같은 help파일을 볼 수 있다. (예제는 생략)
//;;;;;
SinOsc                        interpolating sine wavetable oscillator

SinOsc.ar(freq, phase, mul, add)

This is the same as Osc except that the table is a sine table of 8192 entries.
freq – frequency in Hertz
phase – phase offset or modulator in radians
//;;;;;

-argument lists (10,2,3)은 comma에 의해 분리시킨다.

{SinOsc.ar(220)}.scope//220Hz의 Sine wave
{SinOsc.ar(220,0,0.3)}.scope//look at the amplitude

-amplitude를 변경하되 phase값을 변경하고 싶지는 않다면 :
mul:을 사용한다.

{SinOsc.ar(220, mul:0.3)}.scope
{SinOsc.ar(mul:0.3)}.scope

//—————————————————–
3. Defaults
UGen은 Argument에 default 값을 가진다. 이것을 알고싶으면 UGen을 선택하고 menu 에서
Lang>Open Class Def.을 선택한다.

예를들어 SinOsc에서 default frequency는 440.0이다.:

SinOsc : UGen {        
        *ar {
                arg freq=440.0, phase=0.0, mul=1.0, add=0.0;
                ^this.multiNew(‘audio’, freq, phase).madd(mul, add)
        }
        *kr {
                arg freq=440.0, phase=0.0, mul=1.0, add=0.0;
                ^this.multiNew(‘control’, freq, phase).madd(mul, add)
        }
}

//——————————————

http://csound.x-y.net

Ji Youn Kang,

Csound Max Community

4. Functions/Collections/UGens as object

1. Functions as objects  

-괄호안에 code는 function이 된다.: {code}

{1+2}//enter로 실행후 post window확인
{1+2}.value//값을 보기
{1+2*3}.value

-Funcation은 또한 arguments를 가질수 있고 다음 두가지 방법으로 가능하다.
f = {arg a,b; a*b}//실행
g = {|a,b| a*b}//실행
f.value(10,2)//위의 코드를 실행해 주지 않으면 값을 얻을수 없다.
g.value(10,2)

-a~z까지의 심볼들은 global variables로 정의되고 특정한 선언없이 사용될 수 있다.

//——————————————–
2. Collections as objects
-item의 list
[100,200]
[1,2,3,4,5,6].choose//random choice
[1,2,3,4,5,6].scramble//different arrays
[1,2,3,4,5,6].rotate//rotation
[1,2,3,4,5,6]+10//each number is added by 10

-Collection은 또한 shortcut으로 표기 가능
(1..5)

f=(10..20)
f[1]

(10,12..20)//even number from 10 to 20
(1,3..8) + (1,4..8)

Array.series (10,1,100) //number, start, distance
Array.fill(10,{rrand(400,800)})//number, something to fiill it with such as a function
Array.fill(10, rrand(400,800))//Array가 function{}으로 채워지지 않을경우 같은 값만 출력한다.

//——————————————–
3. UGens(unit generators) as objects
-UGen들을 보려면 다음을 실행
UGen.dumpClassSubtree
또는 click on underline:
          [Tour_of_UGens]
          
-UGens을 audio rate으로 사용할때에는 .ar을 사용한다. 이때에 .ar을 message라 한다.;
SinOsc.ar
control rate: .kr
MouseX.kr

-Function내에서 사용될때에 UGens은 audio/control signals을 produce한다.

——————————————
http://csound.x-y.net
Ji Youn Kang,
Csound Max Community

3. 실행/Number as objects

Supercollider 3에서는 language와 audio part가 나뉘어 있다.:
the language application 와 the server.

The server는 synthesis engine으로 language, 또는 다른 application으로부터 명령(OSC)을 받는다.

1. Language

-Help
Help를 보려면, item을 활성화 한뒤 CMD-?를 누른다.일반적인 정보를 보려면 Help menu에서 window를 오픈.

-Evaluation(실행)
한줄로 된 명령문을 실행하려면, 커서를 라인 맨 뒤에 놓고 ENTER Key를 누른다.
만약 여러줄로 된 명령문이라면 라인들을 활성화 시킨후 ENTER key를 누른다.

다음 실행 문 맨 뒤에 커서를 놓고 ENTER를 눌러보아라.
Help.all;

//————————————–
2. Number as objects
SC는 object를 기반으로 한 언어로서 대부분이 오브젝트로 되어 메세지를 받는다.

Number는 objects로 간주된다.

1
0.5

1보다 작은 소수는 반드시 0을 동반하여야 한다.
.5 –> wrong
0.5 –> right

Objects는 Messages를 동반할 수 있다. 오브젝트 위에 . 뒤에 오는것이 Message :
0.5.sin
60.midicps
60.midicps.reciprocal
10.rand
10.value

위의 expression들이 실행되면 Message Window에 프린트 되어 나타난다. (다음 실행문들에 ENTER를 눌러 실행해보라)

receiver notation:  object.message
                          440.cpsmidi.round
                         
functional notation:  function (argument)
                         cpsmidi(440)
                      round(cpsmidi(440))
                      
random between two limits:
        rrand(10,20)
        rrand(10,20.0)
        10.rrand(20)

——————————————
http://csound.x-y.net
Ji Youn Kang,
Csound Max Community