-Noise Window
;filtered noise with window
//window;
Env.sine(1,1).plot
//SynthDef
(
SynthDef(noiseWindow, {
|dur = 1, cf = 1000, rq= 0.01, amp = 0.4|
Out.ar(0,
BPF.ar(WhiteNoise.ar,
cf,rq)
*
EnvGen.kr(Env.sine(dur,amp), doneAction:2))
}).load(s)
)
// instance
Synth(noiseWindow)
// routine
(
r = Routine({
{Synth(noiseWindow,
[cf,rrand(500,1500), rq, rrand(0.008, 0.02),
amp, rrand(0.1,0.9), dur,rrand(0.6,2)]);
rrand(0.5,5).yield;
}.loop
})
)
r.play;
r.stop;
r.reset.play;
// another Routine
(
r = Routine({
{Synth(noiseWindow,
[cf, rrand(500,2500), rq, 0.005,
amp,1, dur, rrand(0.5,3)]);
rrand(0.01, 0.1).yield;
}.loop
})
)
//——————————————
-Routine as a score
// sine1 SynthDef
(
SynthDef(“sine1”,{arg freq = 440, amp = 0.2, dur = 2.0, attack = 0.25, decay = 0.25;
var ssTime = dur * (1- attack – decay);
var attackTime = dur * attack;
var decayTime = dur * decay;
Out.ar(0,
SinOsc.ar(freq, 0, amp)
* EnvGen.kr(Env.linen(attackTime, ssTime, decayTime,1), doneAction: 2)
)
}).load(s)
)
//one instance
Synth(sine1)
//several instances (to be evaluated in sequence)
Synth(sine1,[freq,62.midicps]);
Synth(sine1, [freq,67.midicps]);
Synth(sine1, [freq,67.midicps]);
Synth(sine1, [freq,69.midicps, dur,1]);
Synth(sine1, [freq,71.midicps,dur,1]);
Synth(sine1, [freq,72.midicps,dur,1]);
Synth(sine1, [freq,69.midicps,dur,1]);
Synth(sine1, [freq,71.midicps,dur,2]);
Synth(sine1, [freq,69.midicps,dur,1]);
Synth(sine1, [freq,71.midicps,dur,1]);
Synth(sine1, [freq,72.midicps,dur,2]);
Synth(sine1, [freq,71.midicps,dur,2]);
Synth(sine1, [freq,69.midicps,dur,1]);
Synth(sine1, [freq,67.midicps,dur,1]);
Synth(sine1, [freq,69.midicps,dur,2]);
Synth(sine1, [freq,67.midicps,dur,4]);
// in a Routine, things can happen with a wait before the next event
(
Routine({
Synth(sine1,[freq,62.midicps]);
2.yield;
Synth(sine1, [freq,67.midicps]);
2.yield;
Synth(sine1, [freq,67.midicps]);
2.yield;
Synth(sine1, [freq,69.midicps, dur,1]);
1.yield;
Synth(sine1, [freq,71.midicps,dur,1]);
1.yield;
Synth(sine1, [freq,72.midicps,dur,1]);
1.yield;
Synth(sine1, [freq,69.midicps,dur,1]);
1.yield;
Synth(sine1, [freq,71.midicps,dur,2]);
2.yield;
Synth(sine1, [freq,69.midicps,dur,1]);
1.yield;
Synth(sine1, [freq,71.midicps,dur,1]);
1.yield;
Synth(sine1, [freq,72.midicps,dur,2]);
2.yield;
Synth(sine1, [freq,71.midicps,dur,2]);
2.yield;
Synth(sine1, [freq,69.midicps,dur,1]);
1.yield;
Synth(sine1, [freq,67.midicps,dur,1]);
1.yield;
Synth(sine1, [freq,69.midicps,dur,2]);
2.yield;
Synth(sine1, [freq,67.midicps,dur,4]);
}).play(SystemClock)
)
참고: events가 위에서는 같은 synthDef를 사용했으나 다른것들을 사용해도 된다.
//——————————————
-Score object
score object는 non-realtime computing에 주로 사용되나 realtime으로도 사용가능하다.
score object는 OSC메세지를 사용해야하며 the various convenience methods사용을 할수 없다.
OSC message
/s_new, synthdef, node, action, target
action (0 is add to head, 1 is add to tail)
targett is target ID (e.g. 0)
/c_set, bus index, control value
this message should conclude the messages for non-realtime use
Score object는 메세지를 보내기 위해 beet단위의 메세지 리스트를 포함한다.
그 리스트는 non-realtime에서는 /c_set을 사용해야하며, realtime에서는 unnecessary.
// make an instance
z =Score.new
//define a list of timed OSC commands
(
x = [
[0,[s_new,sine1,1000,0,0,freq,62.midicps]],
[2,[s_new,sine1,1000,0,0,freq,67.midicps]],
[4,[s_new,sine1,1000,0,0,freq,67.midicps]],
[6,[s_new,sine1,1000,0,0,freq,69.midicps,dur,1]],
[7,[s_new,sine1,1000,0,0,freq,71.midicps,dur,1]],
[8,[s_new,sine1,1000,0,0,freq,72.midicps,dur,1]],
[9,[s_new,sine1,1000,0,0,freq,69.midicps,dur,1]],
[10,[s_new,sine1,1000,0,0,freq,71.midicps,dur,2]],
[12,[s_new,sine1,1000,0,0,freq,69.midicps,dur,1]],
[13,[s_new,sine1,1000,0,0,freq,71.midicps,dur,1]],
[14,[s_new,sine1,1000,0,0,freq,72.midicps,dur,2]],
[16,[s_new,sine1,1000,0,0,freq,71.midicps,dur,2]],
[18,[s_new,sine1,1000,0,0,freq,69.midicps,dur,1]],
[19,[s_new,sine1,1000,0,0,freq,67.midicps,dur,1]],
[20,[s_new,sine1,1000,0,0,freq,69.midicps,dur,2]],
[22,[s_new,sine1,1000,0,0,freq,67.midicps,dur,4]],
[26,[c_set,0,0]] // finish
]
)
// assign list to score
z.score = x;
// score is played using TempoClock, time is in beats;
// to play or stop
z.play
z.stop
If there is a node problem, all nodes on the server can be
released with
s.freeAll
//——————————————
-Sound file rendering(non-realtime synthesis)
Score.write(x, “recordings/score-test.osc”);//write score list to file
//render osc file using the server(scsynth)
“./scsynth -N recordings/score-test.osc _ recordings/score-test.aiff 44100 AIFF int16 -o 1”.unixCmd;
위의 string은 (“”빼고) a terminal command line로서 enter될수도 있다.
Calls scsynth
-N : nonreal time
recordings/score-test.osc : the path for the binary file with osc commands
-no audio input file
recordings/score-test.aiff : the name of the sample rate
sample format
option:1 (mono)
더 많은정보는 여기에 Non-Realtime-Synthesis
//——————————————
http://csound.x-y.net
Ji Youn Kang,
Csound Max Community