Monday, May 26, 2008

CC3 Week 9 - Streams (II)

For this week's patch I used the synthdef I made in week 7. I have used the Pshuf to generate a sequence to control the speed, modulator frequency and modulator amplitude of the sample. I found this weeks exercise fairly straight forward since the ideas were really just the same as last week.

Click here for my audio example [464KB].


b = Buffer.read(s, "sounds/Producers @ The Electric Light Hotel.wav");

// Here is the sample for this patch.


(
SynthDef("BufferPlay", {

arg speed = 1, amp = 1, pan = 0, mFreq, mAmp;

var sig, pan2, envStruct, envGen, mod, car, out;

sig = PlayBuf.ar(1, b.bufnum, BufRateScale.kr(b.bufnum) * speed, loop: 1.0);
pan2 = Pan2.ar(sig, pan);

mod = SinOsc.ar(freq: mFreq, mul: mAmp);



// Envelope Structure
envStruct = Env(
levels: [0, 1, 0.5, 0.3, 0],
times: [2.0, 1.0, 3.0, 10.0],
curve: 'lin'
).plot;
// Envelope Instance
envGen = EnvGen.kr(
envelope: envStruct,
gate: 1.0,
doneAction: 2.0
);





Out.ar(bus: 0, channelsArray: amp * pan2 * mod* envGen);

}).send(s);
)

a = Synth("BufferPlay", [\speed, 1, \pan, -1, \mFreq, 1, \mAmp, 1]);



(
var a, b, c, d;
a = Pshuf.new(#[1, 1.5, 2, 2.5], 3).asStream;
b = Pshuf.new(#[1, 2, 3, 4], 3).asStream;
c = Pshuf.new(#[0.25, 0.5, 0.75, 1], 3).asStream;
d = Pshuf.new(#[0.25, 0.5, 0.75, 1], 3).asStream;

Task({
12.do({
Synth("BufferPlay", [ \speed, a.next, \mFreq, b.next, \mAmp, c.next ]);
d.next.wait;
});
}).play
)


[1] Christian Haines. "Creative Computing: Semester 1 - Week 9 - Streams II". Lecture presented at the Electronic Music Unit, University of Adelaide, South Australia, 1st May 2008

No comments: