wavey-wind/sc/ww1.scd

134 lines
2.0 KiB
Plaintext
Raw Normal View History

2022-05-05 19:39:06 +02:00
// Zacetek / konec
Server.local.boot;
Server.local.quit;
s.boot;
s.stop;
// Server -> Boot /// Ctrl+B
{SinOsc.ar}.play; // Shift+Enter evalvira
// Ctrl + . ustavi zvok!
// Start/stop prek spremenljivke
x = {SinOsc.ar}.play;
x.free;
// HELP: shift+ctrl+D
// recimo ugen
{SinOsc.ar(SinOsc.kr(1, 0, 1, 1), 0, 1, 0)}.play
{SinOsc.ar(520, 0, SinOsc.ar(3, 0.75, add: 1, phase: 0))}.play;
{VarSaw.ar(42, 0, SinOsc.ar(2, 0.75, add: 1, phase: 0))}.play;
{SinOsc.ar(32, 0, VarSaw.kr(3, 0.75, add: 1, phase: 0))}.play;
{SinOsc.ar(100, )}.play
// Kurzor na keyword in Ctrl+d odpre help zanj
(
{SinOsc.ar(100,)}.play;
{SinOsc.ar(100, 3.14)}.play;
)
()
(
SynthDef.new(\kFaza, {
var a = SinOsc.ar(100);
var b = SinOsc.ar(100, 3.14);
Out.ar(0, a);
Out.ar(1, b);
}).add;
)
(
SynthDef.new(\faza, {
var a = SinOsc.ar(100);
var b = SinOsc.ar(100);
Out.ar(0, a);
Out.ar(1, b);
}).add;
)
s = Synth.new(\kFaza);
v = Synth.new(\faza);
z.set(\f, 80);
z.set(\f, 200, \amp, 0.5);
NetAddr.langPort;
a= 0;
b= 0;
c= 0;
d= 0;
// WW
// Receiver function
(
SynthDef.new(\slOSC, {
// Najprej argumenti, potem variable
arg f=0, ampOsc=0, ch=0, off=0;
var so;
so = SinOsc.ar(f, off, SinOsc.kr(ampOsc));
Out.ar(ch, so);
}).add;
a = Synth.new(\slOSC);
b = Synth.new(\slOSC);
c = Synth.new(\slOSC);
d = Synth.new(\slOSC);
s = [a, b, c, d];
OSCFunc({
arg msg, time, addr, recvPort;
//[msg, time, addr, recvPort].postln;
~gX = msg[1] * 100;
~gY = msg[2] / 3;
}, '/euler', n);
OSCFunc({
arg msg, time, addr, recvPort;
//[msg, time, addr, recvPort].postln;
4.do({
arg i;
if (msg[i + 1] == 1.0) {
s[i].set(\f, ~gX);
s[i].set(\ampOsc, ~gY);
s[i].set(\off, ~gZ);
}
});
}, '/keys', n);
)
// ENDWW
(
w = {
arg noiseHz = 2.5;
var f, sig, amp;
// Med 200 in 1000 Hz
//f = LFNoise0.kr(8, 400, 600);
// f = LFNoise0.kr(8).range(200, 1000)
f = LFNoise0.kr(noiseHz).exprange(300, 600);
amp = LFNoise1.kr(9).exprange(0.2, 1);
sig = SinOsc.ar(f) * amp;
}.play;
)
w.set(\noiseHz, 48);
w.set(\noiseHz, exprand(260, 400));
w.free;