Lydteknik · Musik · Programmering · SuperCollider

Lidt SuperCollider

// Her er lidt SuperCollider
(
{
var y,z, v; //husk semikolon
y=LFNoise1.kr(freq: 1,mul: 440,add: 0); //Generates linearly interpolated random values at a rate given by the nearest
z=LFNoise1.kr(freq: 1,mul: 440,add: 0); //integer division of the sample rate by the freq argument.
v=Blip.ar(freq: [y, z], numharm: 16, mul: 1, add: 0);
GVerb.ar(v); //rumklang
}.play
)

//    ************************************************
(
e = SoundFile.new;
e.openRead(“sounds/i59.wav”);
// a.inspect;
//e.close;
e.play;
)

// **************************************************

I “sounds” mappen skal der være nogle lydfiler

~someSounds = “sounds/*”.pathMatch.collect{ |path |  Buffer.read(s, path)}; // kør først denne

~someSounds[2].play; // derefter denne

// **************************************************

f = SoundFile.collect(“sounds/*”)

e = f[8.rand].play;
i = f[8.rand].play;

// ******************************************************************

~someSounds = “sounds/*”.pathMatch.collect{ |path |  Buffer.read(s, path)}; // kør først denne

t = Task({{~someSounds[8.rand].play; 1.wait;}.loop });
t.start;
t.stop;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
f = SoundFile.collect(“vokalsvaerm/*”);
t = Task({{f[5.rand].play; 1.wait;}.loop });

t.start;
t.stop;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

b = SoundFile.collectIntoBuffers(“vokalsvaerm/*”);
b[1].play;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

b = SoundFile.collectIntoBuffers(“vokalsvaerm/*”);

(
// buffer player with done action and control of envelope and panning, from the SuperCollider book
SynthDef(\samplePlayer, { arg out=0, buf = 0,
rate = 1, at =0.01, rel= 0.1, pos =0, pSpeed = 1, lev = 0.5;
var sample, panT,  amp, aux;
sample = PlayBuf.ar(1, buf, rate*BufRateScale.kr(buf), 1, 0, 0);
panT= FSinOsc.kr(pSpeed);
amp = EnvGen.ar(Env.perc(at, rel, lev), doneAction: 2);
Out.ar(out, Pan2.ar(sample, panT, amp));
}).memStore;
)

Synth(\samplePlayer,[\out, 0, \bufnum, b[0], \rel, 0.25]);
Synth(\samplePlayer,[\out, 0, \bufnum, b[b.size.rand], \rel, 0.25]);

////////////////////////////////////////////////////////////////////////////////////////////////

~buffers = SoundFile.collectIntoBuffers(“vokalsvaerm/*”);

(
// buffer player with done action and control of envelope and panning
SynthDef(\samplePlayer, { arg out=0, buf = 0,
rate = 1, at =0.01, rel= 0.1, pos =0, pSpeed = 4, lev = 0.5;
var sample, panT,  amp, aux;
sample = PlayBuf.ar(1, buf, rate*BufRateScale.kr(buf), 1, 0, 0);
panT= FSinOsc.kr(pSpeed);
amp = EnvGen.ar(Env.perc(at, rel, lev), doneAction: 2);
Out.ar(out, Pan2.ar(sample, panT, amp));
}).memStore;
)
Synth(\samplePlayer,[\out, 0, \buf, ~buffers[~buffers.size.rand], \rel, 0.25]);

~buffers[~buffers.size.rand].play;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

b = SoundFile.collectIntoBuffers(“vokalsvaerm/*”);

(
// buffer player with done action and control of envelope and panning, from the SuperCollider book
SynthDef(\samplePlayer, { arg out=0, buf,
rate = 1, at =0.01, rel= 0.1, pos =0, pSpeed = 1, lev = 0.5;
var sample, panT,  amp, aux;
sample = PlayBuf.ar(1, buf, rate*BufRateScale.kr(buf), 1, 0, 0);
panT= FSinOsc.kr(pSpeed);
amp = EnvGen.ar(Env.perc(at, rel, lev), doneAction: 2);
Out.ar(out, Pan2.ar(sample, panT, amp));
}).memStore;
)

//        Mellemrum
(
p = Pxrand([0, 1, 2, 3, 4, 5], inf).asStream;
// ordered sequence of durations
q = Pseq([1, 2, 0.5], inf).asStream;
t = Task({
loop({
x.release(2);
//x = Synth(\default, [freq: p.value.midicps]);
~nowPlaying = Synth(“samplePlayer”, [buf: b[p.value]]);
q.value.wait;
});
});
t.start;
)
t.stop; x.release(2);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s