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

The Sea - The Wind - The SID Chip

Home   How To   Code Pool   Public Library   Theory   Events

Info:

Zusätzliche Informationen: http://wiki.no-brain.net/doku.php?id=no-brain:uni:ws08:rosarauschen

/* 
 * * * * * * * * * * * * * * * * * * * * * * * * *
 *    SC Project by Volker 'sushi' Spaarmann     *
 *                                               *
 *      THE SEA - THE WIND - THE SID Chip        *
 *                                               *
 * * * * * * * * * * * * * * * * * * * * * * * * *
*/


/* STAGE I "THE SEA" */

(
SynthDef(\Sea, { |amp=0.2, gate=1, attack, decay, sustain, retreat|
    var sound, env;
    env = EnvGen.kr(Env.adsr(attack, decay, sustain, retreat, amp), gate, doneAction: 2);
    sound = { Pan2.ar(PinkNoise.ar, Rand(-1, 1))}.dup(5).sum;   ////Stereopanning
    Out.ar(0 , sound * env);
};
).store;
); 

(
Pdef(\AmbiSea,
    Pbind(
        \instrument, \Sea,
        \freq, 0.1,
        \amp, Pstutter(2, Prand([1, 0.7, 0.3], inf) * 0.2) + Pwhite(0, 0.1, inf), //jede zweite variiert
        \attack, 6.5,
        \decay, 1,
        \sustain, 2,
        \retreat, 2.5,
        \gate, 1,
        \dur, Prand([1, 4], inf)  //some variation
    )
).play;
)


/* STAGE II "THE WIND" */

(
SynthDef(\Wind, { |freq=0.1, baseAmp=0.5|
    var mod, sound;
    mod = SinOsc.kr(freq, 0, baseAmp.dup);
    sound = { BPF.ar(WhiteNoise.ar, LFNoise2.kr(0.1).exprange(400, 8000), 0.2) };
    sound = { Pan2.ar(sound, Rand(-1, 1))}.dup(5).sum;
    Out.ar(0 , sound * mod);
};
).store;
); 

(
Pdef(\AmbiWind,
    Pbind(
        \instrument, \Wind,
        \freq, 0.05,
        \amp, 0.05,
        \dur, Pwhite(5.0, 10.0, inf),
        \legato, 1.9
    )
).play;
)


/* STAGE III "THE SID Chip" */

// get the SID6581f UGen from: http://www.fredrikolofsson.com/pages/code-sc.html

// to control one of the 3 generator of the SID emu
(
SynthDef(\sid6581f_single, {|out= 0, gate= 1, freqLo= 0, freqHi= 0, pwLo= 0, pwHi= 0, ctrl= 65, atkDcy= 5, susRel= 5, fcLo= 0, fcHi= 0, res= 0, mode= 15, rate= 1, amp= 1, pan= 0|
  var e, z;
  e= EnvGen.kr(Env.asr(0.01, amp, 0.05), gate, doneAction:2);
  z= SID6581f.ar(
    freqLo, freqHi, pwLo, pwHi,
    ctrl, atkDcy, susRel,
    0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0,
    fcLo, fcHi,
    res, mode, rate
  );
  Out.ar(out, Pan2.ar(z*e, pan));
}).store
)

// Random tunes from the past
(
Pdef(\SID_one,
  Pbind(
    \instrument, \sid6581f_single,
    \dur, 0.8,
    \amp, 0.5,
    \freqHi, 4,
    \pwHi, 10,
    \rate, Pstutter(1, Prand([8, 7, 6, 5, 4, 3, 2], inf)),
    \pan, -0.8 //pan far left
  )
);
)

Pdef(\SID_one).play;

(
Pdef(\SID_two,
  Pbind(
    \instrument, \sid6581f_single,
    \dur, 1.6, // twice the duration of SID_one
    \amp, 0.5,
    \freqHi, 5,
    \pwHi, 30,
    \rate, Pstutter(1, Prand([8, 7, 6, 5, 4, 3, 2], inf)),
    \pan, 0.8 //pan far right
  )
);
)

Pdef(\SID_two).play;

(
Pdef(\SID_three,
  Pbind(
    \instrument, \sid6581f_single,
    \dur, 0.4, // half the duration of SID_one
    \amp, 0.3,
    \freqLo, 80,
    \pwLo, 4,
    \freqHi, 5,
    \pwHi, 4,
    \rate, Pstutter(1, Prand([8, 7, 6, 5, 4, 3, 2], inf))
  )
);
)

Pdef(\SID_three).play;

(
fork {
	Pdef(\SID_one).fork;
	Pdef(\SID_two).fork;
	Pdef(\SID_three).fork;
}
)

// some melodies ... simple but that is old-skool ;)
(
SynthDef(\sid6581f_full, {|out= 0, gate= 1, freqLo0= 0, freqHi0= 0, pwLo0= 0, pwHi0= 0, ctrl0= 65, atkDcy0= 5, susRel0= 5, freqLo1= 0, freqHi1= 0, pwLo1= 0, pwHi1= 0, ctrl1=0 , atkDcy1= 0, susRel1= 0, freqLo2= 0, freqHi2= 0, pwLo2= 0, pwHi2= 0, ctrl2= 0, atkDcy2= 0, susRel2= 0, fcLo= 0, fcHi= 0, res= 0, mode= 15, rate= 1, amp= 1, pan= 0|
  var e, z;
  e= EnvGen.kr(Env.asr(0.01, amp, 0.05), gate, doneAction:2);
  z= SID6581f.ar(
    freqLo0, freqHi0, pwLo0, pwHi0, ctrl0, atkDcy0, susRel0,
    freqLo1, freqHi1, pwLo1, pwHi1, ctrl1, atkDcy1, susRel1,
    freqLo2, freqHi2, pwLo2, pwHi2, ctrl2, atkDcy2, susRel2,
    fcLo, fcHi,
    res, mode, rate
  );
  Out.ar(out, Pan2.ar(z*e, pan));
}).store
)

// "pling" base
(
Pdef(\SID_melody_one,
  Pbind(
    \instrument, \sid6581f_full,
    \dur, 0.2,
    \amp, 0.4,
    \freqLo0, 8,
    \freqHi0, 100,
    \pwLo0, 2,
    \pwHi0, 15,
    \freqLo1, 10,
    \freqHi1, 130,
    \mode, 143,
    \rate, Pstutter(2, Pseq([1, 3],inf), inf))
  )
);
)

// Some drums
(
Pdef(\SID_melody_two,
  Pbind(
    \instrument, \sid6581f_full,
    \dur, Pseq([ Pn(0.4, 2), Pn(0.2, 2), Pn(0.4, 3), 0.3, 0.1, Pn(0.2, 2)], inf),
    \amp, 0.9,
    \ctrl0, 2r10000001,
    \freqHi0, Pseq([ 20, 30, Pn(20, 2), 30, 20, 30, Pn(20, 2), Pn(30, 2)], inf),
    \rate, 1
  )
);
)

// Melody
(
Pdef(\SID_melody_three,
  Pbind(
    \instrument, \sid6581f_full,
    \dur, 0.2,
    \amp, 0.2,
    \freqHi0, Pstutter(16, [ 8, 4], inf),
    \pwHi0, 10,
    \rate, Pseq([ Pseq([ 2, 4, 9, 0], sid2), Pseq([ 2, 4, 9, 9], 4),  Pseq([ 1, 1, 3, 8], 8),  Pseq([ 0.5, 1], 2),  Pseq([  9, 8, 6, 4, 2, 1, 0, 1], 1)], inf).midicps,
    \legato, 1.2
  )
);
)


// Let's go...
(
fork {
	Pdef(\SID_melody_one).fork;
	Pdef(\SID_melody_two).fork;
	Pdef(\SID_melody_three).fork;
}
)


Link to this Page