Created
August 31, 2011 10:24
-
-
Save moxuse/1183252 to your computer and use it in GitHub Desktop.
2005_5 Sequence with GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////2005_5 moxus///////// | |
( | |
Pdef(\comp, | |
Paddp(\ctranspose, Pseq([0,3,0,-5,0,-3,0,5], inf), | |
Ppar([ | |
Pbind(\instrument,"sin-f",\midinote,Prand([60,71,\], inf), | |
\dur,Prand([4],inf),\amp,0.2), | |
Pbind(\instrument,"duct",\midinote,Prand([4,\,0,\,9]+33, inf), | |
\dur,Prand([2,1,0.5],inf),\amp,0.2), | |
Pbind(\instrument,"kicks", | |
\dur,Pseq([4],inf),\amp,0.8), | |
Pbind(\instrument,Pshuf(["clicks","clicks2","clicks3"],inf), | |
\dur,Pseq([0.25],inf),\amp,Pseq([2,1,1,1,4,1,1,1]/4,inf)), | |
Pbind(\instrument,Prand(["snr1","snr2"],inf), | |
\dur,Pseq([2],inf),\amp,1), | |
]) | |
);) | |
Pdef(\comp).play; | |
) | |
Pdef(\comp).fadeTime = 0; | |
Pdef(\comp).stop; | |
////SynthDefs///////// | |
( | |
SynthDef("sin-f",{arg amp=0,freq=550; | |
var out; | |
out=Pan2.ar(SinOsc.ar(freq)*EnvGen.ar(Env.perc(0.01, 1.26, 1, -4),doneAction: 2),SinOsc.ar(2.25)); | |
Out.ar(70,out); | |
}).store; | |
SynthDef("duct",{arg amp=0,freq=550; | |
var out; | |
out=Pulse.ar(freq*200,0.5,0.4)*Decay2.ar(Impulse.ar(60), 0.01, 0.14, 1)*EnvGen.ar(Env.new([0,1,0], [0.15,0],'step'),doneAction: 2); | |
Out.ar(10,Pan2.ar(out,LFNoise2.kr(4))); | |
}).store; | |
SynthDef("kicks",{arg amp=0; | |
var out; | |
out=SinOsc.ar(XLine.kr(120,50,0.08),pi/4,amp).dup*EnvGen.ar(Env.perc(0.03, 0.25, 1, -6),doneAction: 2); | |
Out.ar(20,out); | |
}).store; | |
SynthDef("snr1",{ | |
var dom; | |
dom=28; | |
Out.ar(40,Pan2.ar(Pulse.ar(XLine.kr(dom,6200,0.05),0.5,0.4)*Decay2.ar(Impulse.ar(10), 0.01, 0.14, 5) | |
*EnvGen.kr(Env.perc(0.01,0.097,1,-4), 1, doneAction:2),LFNoise1.kr(4,1))) | |
}).store; | |
SynthDef("snr2",{arg gate=1,gain=800,lpf=1024; | |
var out; | |
y=Pan2.ar(ClipNoise.ar(0.5)*Decay2.ar(Impulse.ar(9), 0.01, 0.02, 5)* | |
EnvGen.kr(Env.perc(0.11,0.18,1,1), 1, doneAction: 2),LFNoise1.kr(4,1)); | |
out = (y*gain)*gate/8; | |
w = y; | |
w = AllpassN.ar(w, 0.1,{[0.1.rand, 0.1.rand]}.dup(2), 1.0); | |
y = (y * -0.5) + (w * 0.5); | |
Out.ar(40,y); | |
}).store; | |
SynthDef("clicks",{arg amp=0; | |
var v,y,a,b,env; | |
env=LFNoise2.kr(0.5,0.1,0.02); | |
a=Pulse.ar(60,0.5,0.5); | |
b=Impulse.ar(700); | |
v=(a clip2:b) | |
*EnvGen.ar(Env.perc(0.004,env,1,4), doneAction:2)*amp; | |
Out.ar(60,Pan2.ar(v,LFNoise1.kr(2))); | |
}).store; | |
SynthDef("clicks2",{arg amp=0; | |
var v,y,a,b,env; | |
env=LFNoise2.kr(0.5,0.1,0.02); | |
a=Pulse.ar(60,0.5,0.5); | |
b=Dust.ar([17000,17400,616,608]); | |
v=(a clip2:b) | |
*EnvGen.ar(Env.perc(0.004,env,1,4), doneAction:2)*amp; | |
Out.ar(40,Pan2.ar(v,LFNoise1.kr(6))); | |
}).store; | |
SynthDef("clicks3",{arg amp=0; | |
var v,y,a,b,env; | |
env=LFNoise2.kr(0.5,0.1,0.02); | |
a=Pulse.ar(60,0.5,0.5); | |
b=Pulse.ar([1700,1720]); | |
v=(a clip2:b)* | |
EnvGen.ar(Env.perc(0.004,env,1,4), doneAction:2)*amp; | |
Out.ar(40,Pan2.ar(v,LFNoise1.kr(6))); | |
}).store; | |
) | |
///////Mixer GUI////// | |
( | |
var w, startButton, amp0, amp1, amp2; | |
var amp3, amp4,amp5; | |
var gain0,gain1,gain2,gain3,gain4,gain5,weta,feedbacker,delayer; | |
var id, cmdPeriodFunc; | |
//mixing SyntheDef | |
SynthDef("mixer1",{arg a0=0,a1=0,a2=0,a3=0,a4=0,a5=0,g0=1,g1=1,g2=1,g3=1,g4=1,g5=1,wet=0.3,buffer,delayTime=2,feedback=0.9; | |
var a,b,c,d,e,f,w,z,g; | |
a=((In.ar([10,11])*g0).softclip)*a0; | |
b=((In.ar([20,21])*g1).softclip)*a1; | |
c=((In.ar([30,31])*g2).softclip)*a2; | |
d=((In.ar([40,41])*g3).softclip)*a3; | |
e=((In.ar([50,51])*g4).softclip)*a4; | |
f=((In.ar(60,2)*g5).softclip)*a5; | |
z = PingPong.ar(buffer,f, 1.0/(delayTime), feedback, 1); | |
w = z; | |
4.do({ w = AllpassN.ar(w, 0.2, {[0.1.rand,0.1.rand] }.dup(2), 2) }); | |
z = (z*(1-wet)) + (w * wet); | |
Out.ar(0,Mix.new([a,b,c,d,e,z])); | |
}).store; | |
id = s.nextNodeID; // generate a note id. | |
// make the window | |
w = SCWindow("Mixer panel", Rect(20, 380, 440, 560)); | |
w.front; // make window visible and front window. | |
w.view.decorator = FlowLayout(w.view.bounds); | |
w.view.background = Color(0.5,0.6,0.1,0.3); | |
// add a button to start and stop the sound. | |
startButton = SCButton(w, 75 @ 24); | |
startButton.states = [ | |
["Start", Color.black, Color(0.3,0.9,0.5,0.3)], | |
["Stop", Color.white, Color(1.0,0.1,0.1,0.8)] | |
]; | |
startButton.action = {|view| | |
if (view.value == 1) { | |
// start sound | |
s.sendMsg("/s_new", "mixer1", id, 0, 1, | |
"a0", amp0.value, | |
"a1", amp1.value, | |
"a2", amp2.value, | |
"a3", amp3.value, | |
"a4", amp4.value, | |
"a5", amp5.value, | |
"g0", gain0.value, | |
"g1", gain1.value, | |
"g2", gain2.value, | |
"g3", gain3.value, | |
"g4", gain4.value, | |
"g5", gain5.value, | |
"wet", weta.value, | |
"feedback",feedbacker.value, | |
"delayTime",delayer.value | |
); | |
}; | |
if (view.value == 0) { | |
// set gate to zero to cause envelope to release | |
s.sendMsg("/n_free", id); | |
}; | |
}; | |
// create controls for all parameters | |
w.view.decorator.nextLine; | |
amp0 = EZSlider(w, 300 @ 24, "Amp10", \amp, | |
{|ez| s.sendMsg("/n_set", id, "a0", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
gain0 = EZSlider(w, 270 @ 22, "gain10", [1,2048,\exponential,0], | |
{|ez| s.sendMsg("/n_set", id, "g0", ez.value); }, 1); | |
w.view.decorator.nextLine; | |
amp1 = EZSlider(w, 300 @ 24, "Amp20",\amp, | |
{|ez| s.sendMsg("/n_set", id, "a1", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
gain1 = EZSlider(w, 270 @ 22, "gain20", [1,2048,\exponential,0], | |
{|ez| s.sendMsg("/n_set", id, "g1", ez.value); }, 1); | |
w.view.decorator.nextLine; | |
amp2 = EZSlider(w, 300 @ 24, "Amp30",\amp, | |
{|ez| s.sendMsg("/n_set", id, "a2", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
gain2 = EZSlider(w, 270 @ 22, "gain30", [1,2048,\exponential,0], | |
{|ez| s.sendMsg("/n_set", id, "g2", ez.value); }, 1); | |
w.view.decorator.nextLine; | |
amp3 = EZSlider(w, 300 @ 24, "Amp40", \amp, | |
{|ez| s.sendMsg("/n_set", id, "a3", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
gain3 = EZSlider(w, 270 @ 22, "gain40", [1,2048,\exponential,0], | |
{|ez| s.sendMsg("/n_set", id, "g3", ez.value); }, 1); | |
w.view.decorator.nextLine; | |
amp4 = EZSlider(w, 300 @ 24, "Amp50", \amp, | |
{|ez| s.sendMsg("/n_set", id, "a4", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
gain4 = EZSlider(w, 270 @ 22, "gain50", [1,2048,\exponential,0], | |
{|ez| s.sendMsg("/n_set", id, "g4", ez.value); }, 1); | |
w.view.decorator.nextLine; | |
amp5 = EZSlider(w, 300 @ 24, "Amp60", \amp, | |
{|ez| s.sendMsg("/n_set", id, "a5", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
gain5 = EZSlider(w, 270 @ 22, "gain60", [1,2048,\exponential,0], | |
{|ez| s.sendMsg("/n_set", id, "g5", ez.value); }, 1); | |
w.view.decorator.nextLine; | |
weta = EZSlider(w, 270 @ 22, "Wet", [0,1,\linear,0], | |
{|ez| s.sendMsg("/n_set", id, "wet", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
feedbacker = EZSlider(w, 270 @ 22, "FeedBack", [0,1,\linear,0], | |
{|ez| s.sendMsg("/n_set", id, "feedback", ez.value); }, 0); | |
w.view.decorator.nextLine; | |
delayer = EZSlider(w, 270 @ 22, "DelayTime", [0.4,8,\linear,0], | |
{|ez| s.sendMsg("/n_set", id, "delayTime", ez.value); }, 1.25); | |
// set start button to zero upon a cmd-period | |
cmdPeriodFunc = { startButton.value = 0; }; | |
CmdPeriod.add(cmdPeriodFunc); | |
// stop the sound when window closes and remove cmdPeriodFunc. | |
w.onClose = { | |
s.sendMsg("/n_free", id); | |
CmdPeriod.remove(cmdPeriodFunc); | |
}; | |
t = Tempo.new; | |
t.bpm = 145; | |
t.gui; | |
) | |
________________ | |
///////add convolution effect//////// | |
( | |
Instr("Conv",{arg note=57,amp=0,lpf=8000; | |
var z; | |
z=Pan2.ar( | |
LPF.ar( | |
Convolution.ar((In.ar(40,2)+In.ar(10,2))*amp, | |
Mix.ar(LFSaw.ar([note,note+4,note+12,note+9].midicps,0,0.6)), 1024, 0.5), | |
lpf) | |
,0.5); | |
Out.ar(0,z) | |
}, | |
#[ | |
\nil,\amp,\freq | |
]); | |
p=Patch.new([ 'Conv' ], | |
[ | |
StreamKrDur( | |
Pshuf([0,5,12,-5]+57, inf), | |
// a float | |
0.1), | |
]); | |
p.gui; | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment