Ludvig
Joined: Jul 25, 2005 Posts: 26 Location: Stockholm - Sweden
|
Posted: Wed May 14, 2008 1:17 pm Post subject:
An attempt at using patterns |
|
|
After reading the nice tutorials on scheduling in supercollider referenced to in the topic "SuperCollider Q&A" on this forum ( ttp://electro-music.com/forum/topic-23855.html ) I tried to sequence a synthdef using patterns. It was a lot easier than I thought it would be and in the spirit of sharing, here is the code.
Code: |
(
SynthDef(\plong,{|flux=5,freq=200|
var sum,osc1,osc2,osc3,osc4,osc5,env;
freq=EnvGen.ar(Env.perc(0,0.0015,freq))+freq+GrayNoise.ar(flux*freq*Rand(0.002,0.01));
osc1 = SinOsc.ar(freq,0,Rand(0.1,0.5))*SinOsc.ar(Rand(0.01,0.01+(flux*0.5)),0.5pi,1);
osc2 = SinOsc.ar(freq*IRand(1,1+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
osc3 = SinOsc.ar(freq*IRand(1,2+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
osc4 = SinOsc.ar(freq*IRand(1,3+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
osc5 = SinOsc.ar(freq*IRand(1,4+flux),0,Rand(0.1,0.5))*SinOsc.ar(Rand(0,flux),0.5pi,1);
sum = Mix.new([osc1,osc2,osc3,osc4,osc5]);
env = EnvGen.ar(Env.perc(0.001,3+Rand(0,10),0.3),doneAction:2);
Out.ar(0,Pan2.ar((sum*env),Rand(-0.6,0.6)));
}).send(s);
SynthDef(\mjau,{|freq=100|
var sum,osc1,osc2,brus,env;
brus = BrownNoise.ar(Rand(0,freq*0.2));
osc1 = SinOsc.ar(freq+brus,0,1);
osc2 = Mix([SinOsc.ar(freq*2.001,Rand(0,2pi),0.5),SinOsc.ar(freq*1.999,Rand(0,2pi),0.5)]);
sum = Mix([osc1,osc2,osc1*osc2]);
env = EnvGen.ar(Env.perc(Rand(0,15),Rand(5,15),0.1),doneAction:2);
Out.ar(0,Pan2.ar((sum*env),Rand(-0.2,0.2)));
}).send(s);
a = Pbind(\instrument,\plong,
\midinote,Pseq([24,12,12,12,31],inf),
\delta,Pseq([1,1,1,0.5],inf),
\flux,Pseq([50,0,0],inf)
).play;
b = Pbind(\instrument,\plong,
\freq,Pseq([36,48,60,60,60,48,72,84,79],inf),
\delta,Pseq([1,1,1,0.5,0.5,0.5,1,7],inf),
\flux,Prand([1,7,8,9,10,11],inf)
).play;
c = Pbind(\instrument,\plong,
\midinote,Pseq([67,84,84,79,72],inf),
\delta,Pexprand(4,20,inf),
\flux,Pexprand(20,40,inf)
).play;
d = Pbind(\instrument,\mjau,
\midinote,Pseq([60,72,74,72,67,60,72,73,72,67,48,36,24,29,24,31,24],inf),
\delta,Pexprand(1,15,inf)
).play;
)
|
The different ways to read from arrays with patterns is really inspiring to me and I feel that this a really intuitive way to approach algorithmic music making.
Anyone else feel like sharing something cool that is pattern based? Does the code pasted above work for you? It runs on psycollider on my laptop running xp so i guess i should run on SC on linux and macos as well since there isn't any GUI stuff but I am not sure. |
|