paul e.

Joined: Sep 22, 2003 Posts: 1567 Location: toronto, canada
Audio files: 2
|
Posted: Mon Aug 07, 2006 9:39 pm Post subject:
|
 |
|
try some of this.. you may have seen this before
GUI stuff for SC3
Code: |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// put three objects on screen
x = GUIScreen.new("GUI test 1", Rect.newBy(80,80,400,200));
x.view = View.new(Pen(action: \fill, foreColor: Color.blue),
[
Rect.newBy(20,20,120,80),
Oval.newBy(25,75,40,60),
View.new(Pen(foreColor: Color.green, offset: 45@65), ["quick fox, lazy dog"])
]);
x.refresh;
)
(
// put three objects on screen
// give Oval a different color by enclosing it in a View with a Pen.
x = GUIScreen.new("GUI test 2", Rect.newBy(80,80,400,200));
x.view = View.new(Pen(action: \fill, foreColor: Color.blue),
[
Rect.newBy(20,20,120,80),
View.new(Pen(foreColor: Color.red), [ Oval.newBy(25,75,40,60) ]),
View.new(Pen(foreColor: Color.green, offset: 45@65), ["quick fox, lazy dog"])
]);
x.refresh;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
var screen, freqSpec, controlArray;
controlArray = FloatArray[800.0]; // a raw array for holding control values.
freqSpec = \freq.asControlSpec; // control spec for frequency
screen = GUIScreen.new("screen", Rect(100,100,800,500),
GUIWindow.new("test", Rect(80,80, 380,160),
VLayout(Pen(textFont: \Gadget, textSize: 16), [
Button(nil, nil, [
["Start", Color.black, Color.green, {
#{ arg controlArray;
{
SinOsc.ar(Plug.ar(controlArray, index: 0), 0, 0.1);
}.play;
}.send(controlArray);
1
}],
["Stop", Color.black, Color.red, { #{ thisGroup.at(0).fadeEnd(0.1) }.send; 0 }]
]),
HLayout(nil, [
Slider(
value: freqSpec.unmap(controlArray.at(0)),
action: { arg value; controlArray.put(0,freqSpec.map(value)) }),
Label(nil,nil, "Frequency")
])
])
)
);
screen.refresh;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
var p, x;
p = Pic.read(":Pics:3legs");
p.dump;
x = GUIScreen.new;
x.view = View.new;
x.view.pen.penMode = \addMin;
x.view.pen.foreColor = Color.black;
x.view.pen.backColor = Color.white;
x.view.items = Array.fill(40, {
ScaledPic.new(nil, p, Rect.newBy(300.rand,300.rand,100.rand,100.rand))
});
x.refresh;
f = {
40.do({ arg i;
x.view.items.at(i).bounds = x.view.items.at(i).bounds
.moveBy(4.rand2,4.rand2).resizeBy(4.rand2,4.rand2);
});
x.refresh;
};
x.sched(0.1, inf, { f.value; 0.1 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
var p, x, b, t, u, f;
p = Pic.read(":Pics:3rd-eye");
p.bounds.postln;
x = GUIScreen.new;
x.view = View.new;
x.view.pen.penMode = \srcCopy;
x.view.pen.foreColor = Color.black;
x.view.pen.backColor = Color.white;
b = View.new(nil, [ "SuperCollider 3" ]);
b.pen.textFont = \Times;
b.pen.textSize = 48;
b.pen.offset = 20@90;
b.pen.bold = true;
t = 0;
u = 0;
f = {
r = Array.fill(8, { arg i; 40 * sin(t * 0.02pi + (i * 0.25pi)) + 50});
s = Array.fill(8, { arg i; 40 * sin(u * 0.0143pi + (i * 0.25pi)) + 50});
a = Array.new(64);
h = 0;
8.do({ arg i;
v = 0;
8.do({ arg j;
a.add(
ScaledPic.new(nil, p, Rect.newBy(h, v, s.at(i), r.at(j)))
);
v = v + r.at(j);
});
h = h + s.at(i);
});
t = t+1;
u = u+1;
x.view.items = [ View.new(Pen.new.foreColor_(rgb(0,64,0)), a), b ];
x.refresh;
};
f.value;
x.sched(1/30, inf, { f.value; 1/30 });
x.refresh;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// XYScopeView test
var s, p, x, b, t, u, f, q;
s = XYScopeView.new(nil, Rect(0,0,400,400), 1000, -0.2, 0.2);
p = Pic.read(":Pics:syn");
q = View.new(Pen.new.foreColor_(rgb(192,192,192)), []);
x = GUIScreen.new("SignalArt test", Rect.newBy(80,80,400,400), View(nil,
[
q,
s,
View.new(
Pen.new.foreColor_(rgb(255,255,255)).offset_(42@82).textFont_(\Charcoal).textSize_(36)
.bold_(true).outline_(true).shadow_(true),
[ "SuperCollider 3" ]),
View.new(
Pen.new.foreColor_(rgb(255,0,0)).offset_(40@80).textFont_(\Charcoal).textSize_(36)
.bold_(true).outline_(true).shadow_(true),
[ "SuperCollider 3" ])
]));
s.pen.foreColor = Color.black;
#{ arg a, b, c, d, e, f;
[a, b, c, d, e, f].dump;
{
var z;
z = XFadeTexture.ar({
var freq, x;
freq = LFPulse.kr(20.0.rand, 0, 1.0.rand,
LFPulse.kr(4.0.rand, 0, 1.0.rand, 8000.rand, 2000.rand));
freq = freq + LFPulse.kr(20.0.rand, 0, 1.0.rand,
LFPulse.kr(4.0.rand, 0, 1.0.rand, 8000.rand, 2000.rand));
x = LFPulse.ar(freq+[0.5,0.5].rand2, 0, 0.5, 0.15, -0.05);
AllpassN.ar(x, 0.05, [0.05,0.05].rand, 0.3);
}, 6, 1, 2);
Scope.ar(z, [a,d], [b,e], [c,f] );
}.play;
}.send(s.xcounts, s.xbufs.at(0), s.xbufs.at(1), s.ycounts, s.ybufs.at(0), s.ybufs.at(1));
//x.fullScreen(640,480);
t = 0;
u = 0;
f = {
r = Array.fill(8, { arg i; 40 * sin(t * 0.02pi + (i * 0.25pi)) + 50});
s = Array.fill(8, { arg i; 40 * sin(u * 0.0143pi + (i * 0.25pi)) + 50});
a = Array.new(64);
v = 0;
8.do({ arg i;
h = 0;
8.do({ arg j;
a.add(
ScaledPic.new(nil, p, Rect.newBy(h, v, r.wrapAt(i+j), s.at(i)))
);
h = h + r.wrapAt(i+j);
});
v = v + s.at(i);
});
t = t+1;
u = u+1;
q.items = a;
x.refresh;
};
x.sched(0, inf, { f.value; 1/30 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// lots of GUI stuff happening at once.
var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
var sv;
// read and plot a sound file
var filename, sound;
filename = ":Sounds:floating_1";
sound = SoundFile.new;
sound.read(filename);
k = SignalArt.new(nil, Rect.newBy(0,300,400,100), sound.data.at(0), scroll:0, zoom:128);
k.pen.foreColor = rgb(200,200,0);
k.pen.penMode = \addMax;
sv = [
ScopeView.new(nil, Rect.newBy(0,0,400,300), 1600, zoom:4),
ScopeView.new(nil, Rect.newBy(0,60,400,300), 1600, zoom:4)
];
sv.at(0).pen.foreColor = rgb(255,255,0);
sv.at(1).pen.foreColor = rgb(255,255,0);
x = GUIScreen.new("big test", Rect(40,90,440,490), View(Pen.new.backColor_(Color.black), [
TextBox( Pen.new.textFont_(\Times).textSize_(9).foreColor_(rgb(128,128,128)),
Rect(0,0,640,480), thisProcess.interpreter.cmdLine),
b = View.new,
sv.at(0),
sv.at(1),
d = View.new,
w = View( Pen.new.textFont_(\Monaco).textSize_(48).foreColor_(rgb(0,99,99))
.offset_(90 @ 0), [ "00000000" ]),
GUIWindow.new("test", Rect(80,80, 180,180)),
c = View.new,
g = View.new(nil, [
BevelRect.newBy(0,0,100,24,2,0),
TextBox(Pen.new.foreColor_(Color.black), Rect(4,4,92,20), "Testing", \center)
]),
Knob.new(Pen.new.action_(\fill).foreColor_(rgb(180,220,220)), Rect.newBy(280,190,32,32)),
Slider.new(Pen.new.action_(\fill).foreColor_(Color.grey).backColor_(Color.grey),
Rect.newBy(350,200,24,180)),
k,
a = View.new(Pen.new.foreColor_(Color.white), [ "SuperCollider 3" ])
], true));
d.pen.penMode = \addMax;
d.pen.action = \fill;
d.pen.foreColor = rgb(64,128,64);
d.items = Array.fill(16, { Rect.newBy(rrand(0,300),rrand(0,300),rrand(0,100),rrand(0,100))});
b.pen.action = \fill;
b.pen.foreColor = Color.blue;
c.pen.foreColor = Color.red;
c.pen.penSize = 2@2;
g.pen.foreColor = Color.grey;
g.pen.backColor = Color.grey;
g.pen.textFont = \Gadget;
g.pen.action = \fill;
g.pen.offset = 80@200;
a.pen.textFont = \Times;
a.pen.textSize = 48;
a.pen.offset = 20@90;
//a.pen.bold = true;
t = 0;
p = Array.fill(10, { Array.fill(10, { rrand(8.0, 32.0) }) });
v = Array.fill(10, { Array.fill(10, { 360.rand }) });
p = Array.fill(10, { Array.fill(10, { rrand(8.0, 32.0) }) });
q = Array.fill(10, { Array.fill(10, { [rrand(12.0, 48.0), rrand(12.0, 48.0),
rrand(12.0, 48.0), rrand(12.0, 48.0)] }) });
f = {
var str;
str = String.new(8);
8.reverseDo({ arg i; str = str.add("0123456789ABCDEF".at((t>>(4*i))&15)) });
w.items = [str];
w.pen.offset.y = t % 440;
if (0.02.coin, {
d.items = Array.fill(16, { Rect.newBy(rrand(0,300),rrand(0,300),rrand(0,100),rrand(0,100))});
});
z = Array.new(400);
10.do({ arg i;
10.do({ arg j;
var s;
s = t * 360 / p.at(i).at(j);
z.add(
//Arc.newBy(i*40+8,j*40+8,32,32,s,v.at(i).at(j));
Arc.newBy(i*40+8,j*40+8,32,32,s,v.at(i).at(j));
);
});
});
b.items = z;
z = Array.fill(10, { arg i;
var x1, y1, x2, y2;
u = ZigZag.new(10);
10.do({ arg j;
x1 = 40*j + 20 + (19 * (sin(2pi/q.at(i).at(j).at(0) * t)));
y1 = 40*i + 20 + (19 * (sin(2pi/q.at(i).at(j).at(1) * t)));
x2 = 40*j + 20 + (19 * (sin(2pi/q.at(i).at(j).at(2) * t)));
y2 = 40*i + 20 + (19 * (sin(2pi/q.at(i).at(j).at(3) * t)));
u.add(Point(x1, y1));
u.add(Point(x2, y2));
});
u;
});
t = t+1;
c.items = z;
k.zoom = 96 * sin(t * 2pi/200) + 128;
x.refresh;
};
f.value;
#{ arg a, b, c, d, e, f;
{
Scope.ar(
CombN.ar(
LFPulse.ar(MouseX.kr(\freq) + [0,0.5],0, LFNoise1.ar([0.4,0.4],0.5,0.5),0.1),
0.3, 0.3, 4),
[a,d], [b,e], [c,f] ).postln;
}.play;
}.send(sv.at(0).counts, sv.at(0).bufs.at(0), sv.at(0).bufs.at(1),
sv.at(1).counts, sv.at(1).bufs.at(0), sv.at(1).bufs.at(1));
x.refresh;
x.sched(0, inf, { f.value; 1/60 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// overlapping windows.
var p, x;
p = Pic.read(":Pics:3rd-eye");
q = Pic.read(":Pics:3legs");
x = GUIScreen.new("screen", Rect(100,100,800,600), View(nil, [
TextBox( Pen(textFont: \Times, textSize: 9, foreColor: rgb(128,128,128), backColor: rgb(0,0,100)),
Rect(0,0,700,500), thisProcess.interpreter.cmdLine),
WindowLayer(nil, [
GUIWindow.new("test", Rect.newBy(40,80, 300,200),
HDivider(nil,
VLayout(nil, [
Slider.new(Pen(foreColor: Color.guiGrey)),
Slider.new,
Slider.new,
Slider.new,
Slider.new
]),
VLayout(Pen(textFont: \Gadget, textSize: 14, backColor:Color.guiGrey), [
Label(nil,nil, "Frequency", \left),
Label(nil,nil, "Phase"),
Label(nil,nil, "Amplitude"),
Label(nil,nil, "Duration"),
Label(nil,nil, "Texture")
])
)
),
GUIWindow.new("test", Rect.newBy(380,40, 300,300),
HLayout(nil, [
HDivider(nil,
HLayout(nil, [
Slider.new(Pen(foreColor: Color.guiGrey)),
Slider.new,
Slider.new,
Slider.new,
Slider.new
]),
VLayout(Pen(foreColor: Color.black, backColor: Color.white, penMode:\srcCopy),
[
ScaledPic(nil,p),
//p,
TextBox(Pen(textSize: 14, backColor:Color.guiGrey),nil,"The quick brown fox jumps over the lazy dog."),
ScaledPic(nil,q)
])),
VDivider(nil,
VLayout(nil, [
HLayout(nil, [
Knob.new,
Knob.new
]),
Slider2D.new(Pen.new(
action: \strokeFill,
foreColor: rgb(128,128,192),
backColor:rgb(128,128,192)
), layoutSize: LayoutSize(weight: 2))
]),
VLayout(nil, [
HLayout(nil, [
Knob.new,
Knob.new
]),
HLayout(nil, [
Knob.new,
Knob.new
])
]), layoutSize: LayoutSize(weight: 0.5)) ], enabled: true)
)
])
]));
x.refresh;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// direct image synthesis
var x, z;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, rot, d, x1, y1, z, r, b;
scale = SinOsc.ar(0.00002, 0, 40, 41);
rot = SinOsc.ar(0.000026, 0, 2pi);
//scale = MouseX.kr([0,80]);
//rot = MouseY.kr([0,4pi]);
#x, y, t = XY.ar(scale, scale, rot: rot);
d = sumsqr(y,x)*0.01;
r = (((atan2(y,x) * 48 + d).sin * 0.5) + 0.5).cubed;
#x, y, t = XY.ar(scale, scale, 10, 8, rot: rot);
d = sumsqr(y,x)*0.01;
b = (((atan2(y,x) * 48 + d).sin * 0.5) + 0.5).cubed;
[r, r+b*0.5, b]
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), z.pic);
x.sched(0, inf, { z.next; x.refresh; 0.02 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// direct image synthesis
var x, z;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, rot;
scale = MouseX.kr([0,80]);
rot = MouseY.kr([0,4pi]);
#x, y, t = XY.ar(scale, scale, rot: rot);
(x.cubed*hypotApx(y,x)).abs.sqrt.sin.squared;
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), z.pic);
x.sched(0, inf, { z.next; x.refresh; 0.02 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// direct image synthesis
var x, z;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, rot;
scale = MouseX.kr([0,20]);
rot = MouseY.kr([0,4pi]);
#x, y, t = XY.ar(scale, scale, rot: rot);
(x.cubed.sin * y.cubed.sin).abs;
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), View(nil,
[
z.pic,
View.new(
Pen.new.foreColor_(Color.red).offset_(40@60).textFont_(\Helvetica).textSize_(24).bold_(true),
[ "SuperCollider 3" ])
]));
x.sched(0, inf, { z.next; x.refresh; 0.04 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// direct image synthesis
var x, z;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, rot, zorg;
scale = MouseX.kr([0.1,1000, \exponential]);
rot = MouseY.kr([0,4pi]);
#x, y, t = XY.ar(scale, scale, rot: rot);
(sumsqr(x.sin,y.abs.sqrt).log.squared.sin + (4/pi*atan2(y,x))).fold2(1) * 0.5 + 0.5;
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), View(nil,
[
z.pic,
View.new(
Pen.new.foreColor_(Color.red).offset_(40@60).textFont_(\Helvetica).textSize_(24).bold_(true),
[ "SuperCollider 3" ])
]));
x.sched(0, inf, { z.next; x.refresh; 0.04 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// direct image synthesis
var x, z;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, rot, zorg;
scale = MouseX.kr([0.1,100, \exponential]);
rot = MouseY.kr([0,4pi]);
#x, y, t = XY.ar(scale, scale, rot: rot);
(sumsqr(x.sin,y.sin).log.squared.sin + (4/pi*atan2(y,x)).squared ).fold2(1) * 0.5 + 0.5;
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), View(nil,
[
z.pic,
View.new(
Pen.new.foreColor_(Color.red).offset_(40@60).textFont_(\Helvetica).textSize_(24).bold_(true),
[ "SuperCollider 3" ])
]));
x.sched(0, inf, { z.next; x.refresh; 0.04 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// direct image synthesis
var x, z;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, rot, zorg;
scale = MouseX.kr([0.1,100000, \exponential]);
rot = MouseY.kr([0,4pi]);
#x, y, t = XY.ar(scale, scale, rot: rot);
(x.abs.sqrt.sin * y.abs.sqrt.sin + (5*atan2(y,x)) ).sin.fold2(1) * 0.5 + 0.5;
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), View(nil,
[
z.pic,
View.new(
Pen.new.foreColor_(Color.red).offset_(40@60).textFont_(\Helvetica).textSize_(24).bold_(true),
[ "SuperCollider 3" ])
]));
x.sched(0, inf, { z.next; x.refresh; 0.04 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// image warping
var x, z, p;
p = Pic.read(":Pics:head", 32);
p.dump;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, amp;
scale = MouseX.kr([1,8000, \exponential]);
amp = MouseY.kr([0,80]);
#x, y, t = XY.ar(scale, scale);
x = x + (amp * sin(0.03 * y + (0.5 * t)));
y = y + (amp * sin(0.03 * x + (0.5 * t)));
//x = (x * 0.3).cubed;
//y = (y * 0.3).cubed;
x = x.fold2(p.bounds.width * 0.5);
y = y.fold2(p.bounds.height * 0.5);
ImageWarp.ar(p, x, y).dump;
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), z.pic);
x.sched(0, inf, { z.next; x.refresh; 0.02 });
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
var x, z, p;
p = Pic.read(":Pics:P7140010.JPG", 32);
p.dump;
z = ImageSynth(Pic.new(Rect.newBy(0,0,256,256), 32),
Synth.new({
var x, y, t, scale, amp, polar, point;
scale = MouseX.kr([1,8000, \exponential]);
amp = MouseY.kr([0,64]);
#x, y, t = XY.ar(scale, scale, rot: 0);
polar = (Point(x,y)).asPolar;
polar.rho = polar.rho + (amp * sin((polar.rho * 0.09) + (t * -0.5)));
point = polar.asPoint;
ImageWarp.ar(p, point.x, point.y);
})
);
z.start;
z.next;
x = GUIScreen.new("pic synth", Rect.newBy(80,80,256,256), z.pic);
x.sched(0, inf, { z.next; x.refresh; 0.02 });
)
|
_________________ Spiral Recordings |
|
paul e.

Joined: Sep 22, 2003 Posts: 1567 Location: toronto, canada
Audio files: 2
|
Posted: Mon Aug 07, 2006 9:42 pm Post subject:
|
 |
|
ok...now for the jazzy action...SC3
Code: |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// demonstrating pausing ugens individually
(
#{
var pattern;
pattern = #[55,63,60,63,57,65,62,65];
f = { arg octave, clockRate, pwmrate, fltrate;
RLPF.ar( LFPulse.ar( Lag.kr(
Sequencer.kr(
`((pattern + (12 * octave)).midicps), // sequencer pattern
Impulse.kr(clockRate) // sequencer trigger
),
0.05 // Lag time coefficient
),
0,
SinOsc.kr(pwmrate, 2pi.rand, 0.4, 0.5), // pulse width modulator
0.1 // pulse amplitude
),
SinOsc.kr(fltrate, 2pi.rand, 1400, 2000), // cutoff freq LFO
1/15 )
};
play({
x = Decay.ar(Impulse.ar(2), 0.15, LFNoise0.ar(LFNoise1.kr(0.3,6000,8000),[0.07,0.07]));
g = [f.value(1,8,0.31,0.2), f.value(0,2,0.13,0.11)] + x;
z = 0.4 * (CombN.ar(g, 0.375, 0.375, 5) + g.reverse);
});
}.send;
)
#{ Synth.at(0).peep(true,1); }.send;
#{ Synth.at(0).peep(false,1); }.send;
#{ Synth.at(0).at(0).peep(true,1); }.send;
#{ Synth.at(0).at(0).peep(false,1); }.send;
#{ Synth.at(0).children.postln; }.send;
#{ Synth.at(0).at(0).hold(true); }.send;
#{ Synth.at(0).at(0).hold(false); }.send;
#{ Synth.at(0).at(7).hold(true); }.send;
#{ Synth.at(0).at(7).hold(false); }.send;
#{ Synth.at(0).at(14).hold(true); }.send;
#{ Synth.at(0).at(14).hold(false); }.send;
#{ Synth.at(0).at(14).peep(true); }.send;
#{ Synth.at(0).at(14).peep(false); }.send;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// driving a set of Plugs with a Pattern
#{
var pattern, stream, z, notes;
//notes = [60,62,63,65,67,69,70, 72, 74,75,63,67,70];
//notes = [60,61,63,64,66,67,69,70,72];
//notes = [60,62,64,66,68,70,72];
//notes = [60,63,64,67,68,71,72,75,76];
notes = [0,2.04,3.86,5.51,7.02,9.69,10.88,12];
pattern = Pbind(\note, Prand(notes+19, inf),
\dur, Prand([0.1,0.1,0.2, 0.4,0.8], inf), \trig, 1);
stream = pattern.asEventStream;
{
v = Mix.arFill(4, { arg i;
var trig, freq, plugs;
plugs = [ Plug.kr(0,0,\trig,\gate,0), Plug.kr(800, MouseX.kr([0,0.4]), \freq) ];
#trig, freq = plugs;
z = UGen.buildSynth;
z.schedStream(1, stream, plugs);
u = VarSaw.ar(freq/(1<<i), 0, LFNoise1.kr(0.6,0.2,0.8), Decay2.kr(trig,0.002,1.5,0.1));
Pan2.ar(u, LFNoise1.kr(0.3));
});
//v = RLPF.ar(v, MouseY.kr([10000,100,\exponential]), 0.2);
4.do({ v = AllpassN.ar(v, 0.05, [0.05.rand, 0.05.rand], 4) });
v;
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// driving Plugs with a Pattern.
#{
var p, s, z, notes;
//notes = [60,62,63,65,67,69,70, 72, 74,75,63,67,70];
//notes = [60,61,63,64,66,67,69,70,72];
//notes = [60,62,64,66,68,70,72];
//notes = [60,63,64,67,68,71,72,75,76];
notes = [0,2.04,3.86,5.51,7.02,9.69,10.88,12];
p = Pbind(\note, Prand(notes+19, inf),
\dur, Prand([0.1,0.1,0.2, 0.4,0.8], inf), \trig, 1);
s = p.asEventStream;
{
v = Mix.arFill(4, { arg i;
var trig, freq, plugs;
plugs = [ Plug.kr(0,0,\trig,\gate,0), Plug.kr(800, MouseX.kr([0,0.4]), \freq) ];
#trig, freq = plugs;
z = UGen.buildSynth;
z.sched(1, inf, {
var event;
event = s.next;
plugs.do({ arg plug; plug.source = event; });
event.delta;
});
u = VarSaw.ar(freq/(1<<i), 0, LFNoise1.kr(0.6,0.2,0.8), Decay2.kr(trig,0.002,1.5,0.1));
Pan2.ar(u, LFNoise1.kr(0.3));
});
4.do({ v = AllpassN.ar(v, 0.05, [0.05.rand, 0.05.rand], 4) });
v;
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// adding many things to the top level spawn.
(
#{
{
var exc, amp;
amp = LFPulse.kr(4,0,0.1,0.002);
exc = LPZ1.ar(GrayNoise.ar([amp,amp]));
Klank.ar(`[FloatArray.fill(4, { rrand(80.0,400.0) }),
nil,
FloatArray[1, 1, 1, 1]], exc);
}.play;
}.send;
)
(
#{
{
var exc, amp;
amp = LFPulse.kr(8,0,0.1,0.002);
exc = LPZ1.ar(GrayNoise.ar([amp,amp]));
Klank.ar(`[FloatArray.fill(4, { rrand(80.0,400.0) }),
nil,
FloatArray[1, 1, 1, 1]], exc).abs;
}.play;
}.send;
)
(
#{
{
CombN.ar(LPF.ar(LFNoise0.ar(MouseX.kr([300,2200])*[1,1.1],LFPulse.kr(1,0,0.3,0.1)), 800).abs, 0.2, [0.2,0.17], 5);
}.play;
}.send;
)
(
#{
{
var amp, my;
amp = LFPulse.kr(0.5,0,0.5);
my = MouseY.kr([400,3200]);
Mix.arFill(8, {
var x;
x = Formlet.ar(Dust.ar(12,[0.05,0.05]) * amp, my * exprand(0.5,2.0), 0.005, 0.1);
AllpassN.ar(x, 0.05,0.05.rand, 8);
});
}.play;
}.send;
)
(
#{
{
var freq;
freq = Sequencer.kr(`([27,24,22,24]+2), Impulse.kr(0.25)).midicps + [0,0.3];
RLPF.ar(LFPulse.ar(freq,0,0.2,0.4,-0.2), 300, 0.5);
}.play;
}.send;
)
(
// pulsed noise
#{
{
OverlapTexture.ar({
[
{
var amp;
amp = SinOsc.ar(8,0,4).max(0);
Pan2.ar(Resonz.ar(WhiteNoise.ar(amp), ([27,24,22,29,31] + 62).choose.midicps, 0.01), 1.0.rand2);
},
0
].choose.value;
}, 0.2, 3.8, 2, 2);
}.play;
}.send;
)
(
// noise beats
#{
{
var trig, amp, x;
trig = ImpulseSequencer.ar(`([0.2,0.1,0.1,0.2,0.1,0.1,0.2,0.1]*1), Impulse.ar(8));
amp = Decay2.ar(trig,0.0004,0.2);
x = Resonz.ar(GrayNoise.ar([amp,amp]), 5200, 0.2);
4.do({ x = AllpassN.ar(x, 0.05,[0.05.rand,0.05.rand], 4) });
x
}.play;
}.send;
)
(
// smooth noise
#{
{
OverlapTexture.ar({
[
{ Pan2.ar(Resonz.ar(WhiteNoise.ar(4), ([27,24,22,29,31] + 62).choose.midicps, 0.01), 1.0.rand2);},
0
].choose.value;
}, 0.2, 3.8, 2, 2);
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// a cyclic graph
#{
{
thisGroup.blockSize = 1;
m = SinOsc.ar;
n = WhiteNoise.ar(700, 800 + (m*700));
m.setInput(0, n);
m * 0.1;
}.play;
}.send;
)
(
// no feedback
#{
{
m = SinOsc.ar(0);
n = WhiteNoise.ar(700, 800);
m.setInput(0, n);
m * 0.1;
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
#{
{
var clock, trig, freq, x, root;
clock = Impulse.kr(8);
trig = ImpulseSequencer.kr(`[0.4,0.1,0.2,0.1], clock);
root = Sequencer.kr(`[24, 26, 24, 22], PulseDivider.kr(clock, 64));
x = RLPF.ar(
(Decay2.kr(trig, 0.005, 0.7) * GrayNoise.ar([0.4,0.4])),
MouseX.kr([200,8000,\exponential]),
0.2).distort;
trig = ImpulseSequencer.kr(`[0.4,0.0,0.1,0.1,0.4,0.1,0.1,0.1], clock);
freq = (Sequencer.kr(`[33, 33, 35, 36, 45, 47, 38, 40, 33, 33, 35, 36, 47, 48, 50, 52], clock) + root).midicps;
z = VarSaw.ar(freq*[1,1.505], 0, MouseY.kr, Decay2.kr(trig, 0.005, 1.4));
CombN.ar(x+z*0.5, 0.26, 0.26, 4).softclip;
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
#{
{
var clock, trig, freq, x, scale, root, p;
p = Prand([
Pseq([0,0,1,2,7,8,9,8, 10,10,1,2,1,2,3,4, 0,0,1,2,7,8,9,8, 11,11,1,2,1,2,3,4]),
Pseq([0,0,1,2,7,8,3,4, 0,0,1,2,1,2,3,4, 0,0,1,2,7,8,3,4, 0,0,1,2,1,2,3,4], 2)
], inf).asStream;
clock = Impulse.kr(12);
root = Sequencer.kr(`[57,59,62,55], PulseDivider.kr(clock, 128));
trig = ImpulseSequencer.kr(`[1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,1,1,0,1,0,1,0,1,1], PulseDivider.kr(clock, 2));
r = LPF.ar(RLPF.ar(
(Decay2.kr(trig, 0.005, 0.7) * BrownNoise.ar([3,3])),
MouseX.kr([200,300,\exponential]),
0.4).distort, 800);
r =0;
trig = ImpulseSequencer.kr(`[0.4,0.1,0.2,0.1], clock);
x = RLPF.ar(
(Decay2.kr(trig, 0.005, 0.3) * GrayNoise.ar([0.4,0.4])),
MouseX.kr([200,8000,\exponential]),
0.2).distort;
scale = [0, 2, 3, 5, 7, 8, 10];
trig = ImpulseSequencer.kr(`([0.4,0.0,0.1,0.1,0.4,0.1,0.1,0.1]*1.5), clock);
//freq = (Sequencer.kr(`([0,0,1,2,7,8,3,4, 0,0,1,2,1,2,3,4].degreeToKey(scale) - 12), clock)+root).midicps;
freq = (Sequencer.kr({ p.next.degreeToKey(scale) - 12 }, clock)+root).midicps;
z = RLPF.ar(VarSaw.ar(freq*[1,1.505], 0, MouseY.kr, Decay2.kr(trig, 0.005, 0.8)),
MouseX.kr([200,8000,\exponential]),
0.2).distort;
trig = ImpulseSequencer.kr(`([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1]*0.2), clock);
y = SinOsc.ar((root+24).midicps, 0, Decay2.kr(trig, 0.005, 0.2));
trig = ImpulseSequencer.kr(`([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1]*0.3), clock);
w = SinOsc.ar((root+24+7).midicps, 0, Decay2.kr(trig, 0.005, 0.2));
z = (r+x+z+[y,w]) * 0.4;
//z.softclip;
CombN.ar(z, 0.51, 0.51, 4, 0.4, z.reverse).softclip;
//6.do({ z = AllpassN.ar(z, 0.03, [0.03.rand,0.03.rand], 4) });
//z.softclip;
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
#{
{
var clock, trig, freq, x, scale, exc, p, q;
var z=0.0,a=0.1,b=0.2,c=0.4;
p = Pseq([
Pseq([c,z,z,z,z,z,z,z],2),
Pseq([c,z,z,b,z,z,b,z,c,z,z,z,b,z,b,a],2),
Prand([
Pseq([c,z,z,b,z,z,b,z,c,z,b,z,c,z,b,z],2),
Pseq([c,z,a,b,z,a,b,z,c,z,b,z,c,a,b,a],2),
Pseq([c,a,a,b,z,a,b,a,c,z,b,z,c,a,b,a],2),
Pseq([c,a,a,b,z,a,b,a,c,z,b,z,z,b,a,a],2),
Pseq([c,z,z,z,z,z,z,z],2),
Pseq([c,z,z,b,z,z,b,z,c,z,z,z,b,z,b,a],2)
], inf)
]).asStream;
q = Prand([
Pseq([c,z,b,z,a,a,a,a,b,z,b,z,z,z,b,z],2),
Pseq([c,z,z,z,z,z,z,z,b,z,b,z,z,z,c,z],2),
Pseq([c,z,z,z,a,z,z,z,b,z,b,z,a,z,c,z],2)
], inf).asStream;
clock = Impulse.kr(9);
// bass drum
trig = PulseDivider.kr(clock, 16);
r = SinOsc.ar(80, 0, Decay2.kr(trig, 0.005, 0.5, 0.3));
// drum
trig = ImpulseSequencer.kr(p, clock);
exc = WhiteNoise.ar(Decay2.kr(trig, 0.005, 0.05));
x = Klank.ar(`[FloatArray.fill(4, {rrand(80,800)}),nil,FloatArray.fill(4, {rrand(0.05,0.2)})], exc).distort * 0.2;
// metallic
trig = ImpulseSequencer.kr(q, clock);
exc = WhiteNoise.ar(Decay2.kr(trig, 0.005, 0.05));
s = Klank.ar(`[FloatArray.fill(4, {rrand(3500.0,4000.0)}),nil,FloatArray.fill(4, {rrand(0.05,0.2)})], exc).distort * 0.1;
// whine
exc = GrayNoise.ar([0.0007,0.0007]);
y =
OverlapTexture.ar({
Klank.ar(`[FloatArray.fill(4, {rrand(200,2500)}),nil,FloatArray.fill(4, {rrand(0.2,0.8)})], exc)
* SinOsc.kr(rrand(1.0,6.0), [2pi.rand,2pi.rand], 0.5, 0.5);
}, 4,2,2,3).scaleneg(MouseX.kr(\bipolar));
x = x+y+s+r;
6.do({ x = AllpassN.ar(LPZ2.ar(x), 0.03, [0.03.rand,0.03.rand], 5) });
x
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
#{
{
var clock, trig, freq, x, scale, exc;
var z=0.0,a=0.1,b=0.2,c=0.4;
clock = Impulse.kr(16);
x = SinOsc.ar( Sequencer.kr({ rrand(2000.0, 12000) }, clock), 0, Decay2.kr(clock, 0.002, 0.04));
CombN.ar(x, 0.2, [rrand(0.04,0.2),rrand(0.04,0.2)], 2, Line.kr(0.2,0,4));
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
#{
{
var clock, trig, freq, x, scale, exc;
var z=0.0,a=0.1,b=0.2,c=0.4;
clock = Impulse.kr(XLine.kr(24,1,12));
x = SinOsc.ar( Sequencer.kr({ rrand(2000.0, 12000) }, clock), 0, Decay2.kr(clock, 0.002, 0.04));
CombN.ar(x, 0.1, [exprand(0.02,0.05),exprand(0.02,0.05)], 2, Line.kr(0.2,0,12))
+CombN.ar(x, 0.1, [exprand(0.02,0.05),exprand(0.02,0.05)], 2, Line.kr(0.2,0,12));
}.play;
}.send;
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(
// punk trance
#{ {
var clock, trig, p, freq, env;
p = Pseq([
Pseq([24,24,24,24,26,26,26,26,27,27,27,27,26,26,26,22] + 12, 3),
Pseq([24,24,24,24,26,26,26,26,27,27,27,27,26,26,26,27] + 12, 1),
Pseq([29,29,29,29,27,27,27,27,29,29,29,29,30,30,30,30] + 12, 3),
Pseq([29,29,29,29,27,27,27,27,29,29,29,29,30,30,30,24] + 12, 1),
Pseq([24,24,24,24,26,26,26,26,27,27,27,27,26,26,26,22] + 14, 3),
Pseq([24,24,24,24,26,26,26,26,27,27,27,27,26,26,26,19] + 14, 1),
Pseq([24,24,24,24,26,26,26,26,27,27,27,27,26,26,26,22] + 11, 3),
Pseq([24,24,24,24,26,26,26,26,27,27,27,27,26,26,26,23] + 11, 1)
], inf).asStream;
clock = Impulse.kr(12);
trig = ImpulseSequencer.kr(`[0.3,0.1,0.2,0.1], clock);
env = Decay2.kr(trig, 0.005,0.15, 0.3);
x = PinkNoise.ar([2,2]) * env;
// flanger
z = LinExp.kr(LFTri.kr(0.2),-1,1,1/18000, 1/50); // flanger lfo
3.do({ x = DelayL.ar(x, 0.1, z, 1, x); }); // delays
x = RLPF.ar(x, MouseY.kr([200,8000]),0.2, 0.6).distort;
trig = PulseDivider.kr(clock,2);
freq = Sequencer.kr(p, trig).midicps;
env = Decay2.kr(trig, 0.002,2, 0.6);
y = RLPF.ar(LFSaw.ar(freq*[1,1.505],0,env*8), MouseX.kr([100,8000,\exponential]) * (1+env),
0.1).distort * 0.08;
x = CombN.ar(x+y, 0.33, 0.33, 2, 0.5, x);
w = x;
4.do({ w = AllpassN.ar(w, 0.05, [0.03.rand, 0.03.rand], 4); });
w;
}.play; }.send
)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
_________________ Spiral Recordings |
|