View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

Sidechaining und diverse SynthDefs

Home   How To   Code Pool   Public Library   Theory   Events
Programm 3, Sidechaining:

(

/*********************/
/*** SynthDef KICK ***/

SynthDef(\kick, { arg i_out, env_out, bps, amp, duck_width=1, duck_fadespeed=1;
var imp, attack, decay, env, duck_env, kick;

// rhythmische Hüllkurve aus Impulsen
imp = Impulse.kr(bps/2) + Impulse.kr(bps/4,0.25);

// Verändern der Impuls-Form für den Sound
attack = 0.2;
decay = 0.8;
env = Decay2.kr(imp, attack/bps, decay/bps);

// Verändern der Impuls-Form für das Sideshaining Signal, u.a. Umkehrung des Signals durch "1 - Signal"
duck_env = 1 - (duck_fadespeed * Decay2.kr(imp, (attack/bps)*duck_width, (decay/bps)*duck_width));

// Perkussiver Sound durch dynamisch gefilterten Mix aus SinOSC und BrownNoise
kick = Pan2.ar(LPF.ar(HPF.ar(BrownNoise.ar(env)*SinOsc.ar(140),50),EnvGen.kr(Env.new([0,0,1000,5000,0],[4,16,4,10]),doneAction:0)));

// Ausgabe des Sounds
Out.ar(i_out,[kick,kick]*amp);

// Parallele Ausgabe des Sidechaining Signals auf separatem Kanal
Out.kr(env_out,duck_env);

}).store;

/*********************/




/*********************/
/*** SynthDef WAVE ***/

SynthDef(\wave, { arg i_out, env_in, freq, amp;
var duck_env, wave;

// Greife das Sidechaining-Signal auf...
duck_env = In.kr(env_in,1);

// ...und benutze es als Lautstärke-Kurve.
wave = LFSaw.ar([freq,freq*1.5,freq/2,freq/3,freq/4],0,duck_env);

// Sound-Ausgabe
Out.ar(i_out,[wave,wave]*amp);

}).store;

/*********************/




/**********************/
/*** SynthDef WAVE2 ***/

SynthDef(\wave2, { arg i_out, env_in, freq, amp;
var duck_env, wave;

// Greife auch hier das Sidechaining-Signal auf...
duck_env = In.kr(env_in,1);

// ...und benutze es für Variationen in Lautstärke und Frequenz.
wave = SinOsc.ar([freq,freq*2,freq*4,freq/2]*(duck_env+0.5),0,1-(duck_env+0.5));

// Sound-Ausgabe
Out.ar(i_out,[wave,wave]*amp);

}).store;

/**********************/






a = Pbind(
\instrument, Pseq([\kick],1),
\i_out, 0,		// (Kanal für die Soundausgabe)
\env_out, 1,		// Kanal für die Ausgabe des Sidechaining-Signals
\bps, 2,
\amp, 2.6,
\duck_width, 2.2,
\duck_fadespeed, 2
);


b = Pbind(
\instrument, Pseq([\wave],1),
\i_out, 0,		// (Kanal für die Soundausgabe)
\env_in, 1,		// Kanal für die Eingabe des Sidechaining-Signals
\freq, 220,
\amp, 0.03
);


c = Pbind(
\instrument, Pseq([\wave2],1),
\i_out, 0,		// (Kanal für die Soundausgabe)
\env_in, 1,		// Kanal für die Eingabe des Sidechaining-Signals
\freq, 55,
\amp, 0.2
);






a.play;
b.play;
c.play;
)




Programm 2, Loop mit Delay-Sound und Beat:

(
SynthDef(\delayedImpulse, { arg i_out, amp=1, freq=440, bps=2;
var shape, env, sound, delay1, delay2, delay3;
shape = Decay2.kr(Impulse.kr(bps/2),0.2/bps,0.6/bps,1+(bps/3));
env = shape * EnvGen.kr(Env.new([0, 1, 1, 0],[0, 2/bps, 0]), doneAction:2);
sound = LPF.ar(Pan2.ar(LFSaw.ar(freq,0,env),0.0),freq*2);
delay1 = DelayL.ar(sound,1/bps,0.52/bps,0.35);
delay2 = DelayL.ar(sound,1/bps,0.79/bps,0.3);
delay3 = DelayL.ar(sound,1/bps,1.08/bps,0.25);
Out.ar(i_out,[sound+delay2,sound+delay1+delay3]*amp);
}).store;

SynthDef(\pulsingPlane, { arg i_out, amp=1, freq=440, bps=2, panstart=0.0;
var shape, sound;
shape = Decay2.kr(Impulse.kr(bps,0.5),1/bps,2/bps,1+(bps/3),0.2);
sound = Pan2.ar(LPF.ar(LFSaw.ar(freq,0,shape),freq*20),SinOsc.kr(bps/16,panstart*2*pi));
Out.ar(i_out,sound*amp);
}).store;

SynthDef(\snare, { arg i_out, amp=1, bps=2;
var shape, sound;
shape = Decay2.kr(Impulse.kr(bps,0.5),0.01,0.1,1.5);
sound = Pan2.ar(WhiteNoise.ar(shape));
Out.ar(i_out,sound*amp);
}).store;

SynthDef(\hihat, { arg i_out, amp=1, bps=2;
var shape, sound;
shape = Decay2.kr(Impulse.kr(bps,0),0.02,0.05,4) * EnvGen.kr(Env.new([0, 1, 1, 0],[0, 1/bps, 0]), doneAction:2);
sound = Pan2.ar(PinkNoise.ar(shape));
Out.ar(i_out,sound*amp);
}).store;

SynthDef(\bassdrum, { arg i_out, amp=1, bps=2;
var shape, sound;
shape = Decay2.kr(Impulse.kr(bps,0),0,0.4,4) * EnvGen.kr(Env.new([0, 0.6, 0.2, 0],[0, 1/bps, 0]), doneAction:2);
sound = Pan2.ar(LPF.ar(HPF.ar(BrownNoise.ar(shape)*SinOsc.ar(140),60),300));
Out.ar(i_out,sound*amp);
}).store;

a = Pbind(
\instrument, \delayedImpulse,
\midinote, Pseq([
48, 60, 67, 65, 64, 60, 64, 55,
60, 45, 52, 52, 48, 48, 48, 43
], inf),
\bps, 2,
\dur, 0.5,
\amp, 1.5
);

b = Pbind(
\instrument, \pulsingPlane,
\midinote, Pseq([48, 60, 65, 64, 36], 1),
\bps, 1,
\dur, 8,
\amp, Pseq([0.1, 0.07, 0.07, 0.07, 0.2], 1),
\panstart, 1.0
);

c = Pbind(
\instrument, \snare,
\bps, 1,
\dur, inf,
\amp, 1
);

d = Pbind(
\instrument, \hihat,
\bps, 8,
\dur, 0.125,
\amp, Pseq([
1.0, 0, 0.9, 0, 0, 0.1, 0.8, 0.4,
1.2, 0.6, 0.6, 0, 0, 0.1, 0, 0.1
], inf)
);

e = Pbind(
\instrument, \bassdrum,
\bps, 4,
\dur, 0.25,
\amp, Pseq([
0.8, 0, 0, 0,
0, 1.0, 0, 0.7
], inf)
);

a.play;
b.play;
c.play;
d.play;
e.play;

)




Programm 1, Rhythmischer Akkord:

(
SynthDef(\minor7Chord, { arg freq=330, bpm=160, delay=4;
var hertz, notelength, chord, filter, env, env2;
hertz = bpm/60;
chord = (LFPulse.kr(hertz,iphase:0,width:0.4,mul:0.45) + LFPulse.kr(hertz,iphase:0.33,width:0.28,mul:0.4)) * Mix(Saw.ar(freq * [0.375,1,1.1875,1.5,1.78125]));
filter = LPF.ar(chord,freq*2);
env = EnvGen.ar(Env.new([0,1,0],[0.01,delay/hertz]), doneAction:2);
env2 = EnvGen.ar(Env.new([0,0.8,0],[0.3,0.8*delay/hertz]), doneAction:2);
Out.ar(0, [filter*env,filter*env2]);
};
).store;

Pdef(\variation,
Pbind(
\instrument, \minor7Chord,
\freq, Pseq([
220,110,165,220,
220,330,275,220,
220,330,495,220,
220,110,495,448
],inf),
\bpm, 140,
\delay, 4,
\dur, 176/140
)
);

Pdef(\variation).play;
)


Link to this Page