Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: random patterns
name
code content
( SynthDef(\blo, { arg out=0, amp=0.1, gate=1, pan=0, freq=200; var sig; sig = SinOsc.ar(freq*[1,1.001]); sig = sig * EnvGen.ar(\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:2); sig = Pan2.ar(sig, pan, amp); Out.ar(out, sig); }).add; SynthDef(\raid, { arg out=0, amp=0.1, gate=1, pan=0, freq=200; var sig; sig = LFSaw.ar(freq * [1,1.001]); sig = RLPF.ar(sig, freq*2); sig = sig * EnvGen.ar(\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:2); sig = Pan2.ar(sig, pan, amp); Out.ar(out, sig); }).add; SynthDef(\raid2, { arg out=0, amp=0.1, gate=1, pan=0, freq=200; var sig; var env1 = EnvGen.kr(Env([1,2,1],[0.01,0.8]), 1); sig = LFSaw.ar(freq * [1,1.001, 1 + Rand(0,0.0001)]); sig = RLPF.ar(sig, freq*env1 * [1,1 + Rand(0,0.1),2,1.01]); sig = sig * EnvGen.ar(\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:2); sig = Pan2.ar(sig, pan, amp).flop; Out.ar(out, sig); }).add; SynthDef(\raid3, { arg out=0, amp=0.1, gate=1, pan=0, freq=200; var sig; var xfreq; var env1 = EnvGen.kr(Env([1,2,1],[0.01,0.8]), 1); xfreq = freq * ( 1 + ( SinOsc.ar(Rand(1,500)) * Rand(0.1,3) )); sig = LFSaw.ar(xfreq * [1,1.001, 1 + Rand(0,0.0001)]); sig = RLPF.ar(sig, freq*env1 * [1,1 + Rand(0,0.1),2,1.01]); sig = sig * EnvGen.ar(\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:2); sig = Pan2.ar(sig, pan, amp).flop; //sig = sig * 0.5; Out.ar(out, sig); }).add; ); ( Pdef(\cri, Ppar( 5.collect({ Plazy({ var x = [ 14.rand, 14.rand, 14.rand, 14.rand, ]; Pfindur(8.rand+1, Pbind( \instrument, [ \blo, \raid, \raid2, \raid3, \default, ].choose, \legato, 1.0.rand + 0.1, \adsr, Pseq([ [ [ Env.adsr(0.1,0.1,0.8,0.1) ], [ Env.adsr(0.2,0.1,0.8,0.1) ], [ Env.adsr(0.02,0.1,0.8,0.3) ], [ Env.adsr(0.02,0.1,0.6,0.7) ], ].choose ],inf), \degree, [ Pseq(x.keep(2),inf), Pseq(x[[1,0,1,2]],inf), Pseq(x,inf), Pseq(x.mirror,inf), Pseq({x.choose}!4,inf), Pseq({x.choose}!1,inf), ].choose, \octave, [3,4,5,6].choose, \dur, [ Pseq([2**8.rand/8, 1/4],inf), //Pseq([2**8.rand/8],inf), ].choose, \amp, 0.1/4 ) ) }).loop }) ) ).play; ); ( Pdef(\cri, Ppar( 5.collect({ Plazy({ var x = [ 14.rand, 14.rand, 14.rand, 14.rand, ]; Pfindur(8.rand+1, Pbind( \instrument, [ \blo, \raid, \raid2, \raid3, \default, ].choose, \legato, 1.0.rand + 0.1, \adsr, Pseq([ [ [ Env.adsr(0.1,0.1,0.8,0.1) ], [ Env.adsr(0.2,0.1,0.8,0.1) ], [ Env.adsr(0.02,0.1,0.8,0.3) ], [ Env.adsr(0.02,0.1,0.6,0.7) ], ].choose ],inf), \degree, [ Pseq({x.choose}!2,inf), Pseq({x.choose}!1,inf), Pseq({x.choose}!4,inf), Pseq({x.choose}!3,inf), ].choose, \octave, [3,4,5,6].choose, \lag, [0,1/4,1/8,0].choose / 2, \lag, 1.0.rand / 16, \isRest, Pseq([1,0,0.5,0.3],inf).coin.not, \dur, [ Pseq([2**2.rand/8, 1/4],inf), Pseq([2**4.rand/8, 1/8],inf), //Pseq([2**8.rand/8],inf), ].choose, \amp, 0.1/4 ) ) }).loop }) ) ).play; ); ( Pdef(\cri, Ppar( 5.collect({ Plazy({ var x = [ 14.rand, 14.rand, 14.rand, 14.rand, ]; Pfindur(8.rand+1, Pbind( \instrument, [ \blo, \raid, \raid2, \raid3, \default, ].choose, \legato, 1.0.rand + 0.1, \adsr, Pseq([ [ [ Env.adsr(0.1,0.1,0.8,0.1) ], [ Env.adsr(0.2,0.1,0.8,0.1) ], [ Env.adsr(0.02,0.1,0.8,0.3) ], [ Env.adsr(0.02,0.1,0.6,0.7) ], ].choose ],inf), \degree, [ Pseq([x.choose],inf), ].choose, \octave, [3,4,5,6].choose, //\lag, [0,1/4,1/8,0].choose / 2, //\lag, 1.0.rand / 16, \isRest, [ Pseq([0.51,0.51,0.50,0.50].coin.asInteger.scramble,inf).coin.not, //Pseq([0.51].coin.asInteger.scramble,inf).coin.not, false, ].choose, \dur, [ Pseq([2**2.rand/8, 1/4],inf), 1/8, //Pseq([2**4.rand/8, 1/8],inf), //Pseq([2**8.rand/8],inf), ].choose, \amp, 0.1/4 ) ) }).loop }) ) ).play; );
code description
this generate very diverse compositions, tweaking is easy and change a lot the sounds generated, adding better synthdef can improve further the sound. A lot to explore here
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change