floatAt Examples SC2
floatAt example for sc2
//SC2: after adding the floatAt methods to class Object, the following can be done:
(
var sections, signal, n;
n = 8;
sections = Array.fill(n, { rrand(0.2, [20, 4].choose) });
sections = sections.collect({ arg item; { arg x, y; (x*item).sin+y.sin } });
signal = Signal.newClear(512);
signal.waveFill({ arg x, i; sections.at(x.asInteger).value(x, i/30) }, 0, n-1);
signal.waveFill({ arg x, i; sections.floatAt(x, x, x) }, 0, n-1).normalize;
signal.plot;
{ Osc.ar(signal.asWavetable, 200, 0, 0.1) }.play;
)
//___________________________________
(
var sound, pans;
sound = [
{ arg f, c;
SinOsc.ar(f*10, 0, 0.1)
},
{ arg f, c;
SinOsc.ar(WhiteNoise.ar(c*f, f), 0, 0.4)
},
{ arg f, c;
SinOsc.ar(f, 0, 0.1)*SinOsc.ar(c*100+200, 0, 0.4)
},
{ arg f, c;
var a;
a = Array.fill(8, { c.poll.rand })*200+f;
Mix.ar(Saw.ar(a, 0.05))
}
];
pans = [ -1, 1, { Line.kr(-1, 1, 0.5) }, { SinOsc.kr(3.5) }];
{
var freq, control, scroll, pan;
freq = Sequencer.kr( `(Array.rand(32, 200, 400).round(50)), Impulse.kr(8));
control = MouseY.kr(0, 1); //freq control
scroll = MouseX.kr(0, sound.size-1); //crossfades between sounds
pan = Plug.kr(0);
Spawn.ar({
var pan;
pan = pans.floatAt(control.poll*3);
//a = SinOsc.ar(500, 0, 0.1);
a = sound.floatAt(scroll.poll, freq, control);
Pan2.ar(a, pan)*EnvGen.kr(Env.perc(0.03, 0.7));
}, 2, 0.4);
}.scope;
)
Links to this Page
- enter. last edited on 29 January 2003 at 10:46 pm by 203.14.169.19
- Soft Indexing last edited on 22 May 2003 at 7:21 pm by josephine.hfbk.org