.cc - week eight.
Streams of numbers are commonly used in computer music - this week I have used them make continuos stream of random frequencies and also partials in SuperCollider.
streams.rtf
(
var poly;
poly = Array.newClear(128); //array to hold the synth instances
SynthDef("SoundWallKeys", {
arg freq = 440,
rate = 0.4,
gate = 0.0;
// Variables - declaring
var partials = 20, //number of partials
freqadd = 0,
waveshape,
envStruct,
envGen,
out,
final;
waveshape = {
Mix.fill(
partials, { //each partial's function
SinOsc.ar(
freq: freq + 200.0.rand,
phase: 0,
mul: 1.0 / partials
)
});
};
// Envelope Structure
envStruct = Env(
levels: [0.0,0.99, 0.75, 0.0],
times: [0.1,10.0, 0.1],
curve: 'sine'
); //.plot;
// Envelope Instance
envGen = EnvGen.kr(
envelope: envStruct,
gate: 1.0,
doneAction: 2.0
);
// Output
Out.ar( 0, waveshape * envGen); //add envelope to waveform
Out.ar( 1, waveshape * envGen); //add envelope to waveform
}).send(s);
)
(
var dur, a, b;
dur = 3.7;
a = Routine({ //stream for freq
loop({
750.0.rand.yield;
});
});
b = Routine({ //stream for partials
loop({
25.15.rand.yield;
});
});
Routine({
loop({
Synth( "SoundWallKeys", [ \freq, a.next, \partials, b.next ] );
dur.wait; //make routine wait
});
}).play;
)
.sources.
Haines, Christian 08.05.08, "Streams (1)," Lecture of EMU, Adelaide University.
iieiwrmeieweeiimeemmwreiweremweireeemeimwieewwrwweereireeiimeewmiwwwemwiewimeeeremeiewmemweewieewerwemwiimiewmeiwireiiwrrewmwewree |
13.5.08
Ice Streams
copywrite 9:45 am
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment