https://supercollider.github.io/|SuperCollider-Codebeispiele#

(erstmalig verfasst: 09.10.2021, geändert: 09.10.2021)

Vorarbeit: 
1. % pw-jack scide
   ... ruft die SuperCollider-Entwicklungsumgebung auf, so sie installiert ist
2. Mit [Strg+B] den SuperCollider-Server starten
3. Code eintippern oder per Clipboard übertragen
4. Cursor in Code positionieren und mit [Strg+Returntaste] Code ausführen
5. Nach getaner Arbeit des Codes die Ausführung mit [Strg+.] stoppen

Hilfe für Suchbegriffe: [Strg+Shift+D]

Das folgende Beispiel von Nathaniel Virgo stammt aus einer Sammlung von Tweet-fähigen Beispielcodes (<=140 Zeichen)#

Nathaniel Virgo ("SC140/01-Nathaniel_Virgo.scd")#

(
s.waitForBoot{
//Nathaniel Virgo
{
                LocalOut.ar(a=CombN.ar(
                        BPF.ar( // Butterworth bandpass filter
                                LocalIn.ar(2)*7.5+Saw.ar([32,33], 0.2),
                                2**LFNoise0.kr(4/3,4)*300,0.1).distort.postln, // frequency
                            2,  // rq = bandwith/frequency
                            2,  // mul
                            40  // add
                        )
                );
        a
        }.play//#supercollider
}
)

Was macht es: zufällig komponieren. Für meine Begriffe (Markus) beinahe endlos hörbar.

Reverb-Example mit zufälligen Tonfolgen#

Quelle: https://depts.washington.edu/dxscdoc/Help/Tutorials/Mark_Polishook_tutorial/17_Delays_reverbs.html
(
{
var s, z, y;
    // 10 voices of a random sine percussion sound :
s = Mix.ar(Array.fill(10, { Resonz.ar(Dust.ar(0.2, 50), 200 + 3000.0.rand, 0.003)}) );
    // reverb predelay time :
z = DelayN.ar(s, 0.048);
    // 7 length modulated comb delays in parallel :
y = Mix.ar(Array.fill(7,{ CombL.ar(z, 0.1, LFNoise1.kr(0.1.rand, 0.04, 0.05), 15) }));
    // two parallel chains of 4 allpass delays (8 total) :
4.do({ y = AllpassN.ar(y, 0.050, [0.050.rand, 0.050.rand], 1) });
    // add original sound to reverb and play it :
s+(0.2*y)
}.scope
)

Was macht es: abspielen auf- und abklingender, verhallter, zufälliger Tonfolgen

Gabber Rave#

Quelle: https://sccode.org/1-58T|sccode-Forum mit Hommage an Rave von 1995
// 60Hz Gabber Rave 1995
Server.default.boot;

(
SynthDef(\gabberkick, {
    var snd, freq, high, lfo;
    freq = \freq.kr(440) * (Env.perc(0.001, 0.08, curve: -1).ar * 48 * \bend.kr(1)).midiratio;
    snd = Saw.ar(freq);
    snd = (snd * 100).tanh + ((snd.sign - snd) * -8.dbamp);
    high = HPF.ar(snd, 300);
    lfo = SinOsc.ar(8, [0, 0.5pi]).range(0, 0.01);
    high = high.dup(2) + (DelayC.ar(high, 0.01, lfo) * -2.dbamp);
    snd = LPF.ar(snd, 100).dup(2) + high;
    snd = RLPF.ar(snd, 7000, 2);
    snd = BPeakEQ.ar(snd, \ffreq.kr(3000) * XLine.kr(1, 0.8, 0.3), 0.5, 15);
    snd = snd * Env.asr(0.001, 1, 0.05).ar(2, \gate.kr(1));
    Out.ar(\out.kr(0), snd * \amp.kr(0.1));
}).add;

SynthDef(\hoover, {
    var snd, freq, bw, delay, decay;
    freq = \freq.kr(440);
    freq = freq * Env([-5, 6, 0], [0.1, 1.7], [\lin, -4]).kr.midiratio;
    bw = 1.035;
    snd = { DelayN.ar(Saw.ar(freq * ExpRand(bw, 1 / bw)) + 
    Saw.ar(freq * 0.5 * ExpRand(bw, 1 / bw)), 0.01, Rand(0, 0.01)) }.dup(20);
    snd = (Splay.ar(snd) * 3).atan;
    snd = snd * Env.asr(0.01, 1.0, 1.0).kr(0, \gate.kr(1));
    snd = FreeVerb2.ar(snd[0], snd[1], 0.3, 0.9);
    snd = snd * Env.asr(0, 1.0, 4, 6).kr(2, \gate.kr(1));
    Out.ar(\out.kr(0), snd * \amp.kr(0.1));
}).add;

// this will record to the disk
/*SynthDef("help-Diskout", { |bufnum|
    DiskOut.ar(bufnum, In.ar(0,2));
}).add;
*/
) // zuerst mit [Strg+Return] ausführen

(
var durations;
durations = [1, 1, 1, 1, 3/4, 1/4, 1/2, 3/4, 1/4, 1/2];
Ppar([
    Pbind(*[
        instrument: \gabberkick,
        amp: -23.dbamp,
        freq: 60,
        legato: 0.8,
        ffreq: Pseq((0..(durations.size * 4 - 1)).normalize, inf).linexp(0, 1, 100, 4000),
        dur: Pseq(durations, inf),
        bend: Pfuncn({ |x| if(x < (1/2), 0.4, 1) }, inf) <> Pkey(\dur),
    ]),
    Pbind(*[
        instrument: \hoover,
        amp: -20.dbamp,
        midinote: 74,
        dur: durations.sum * 2,
        sustain: 7,
    ])
]).play(TempoClock(210 / 60));
)
)  // als zweites mit [Strg+Return] ausführen

Sinusbubbles#

s.waitForBoot({
//Server.default = s = Server.internal.boot;
play(
        {
                CombN.ar(
                        SinOsc.ar(
                                midicps(
                                        LFNoise1.ar(3, 24,
                                                LFSaw.ar([5, 5.123], 0, 3, 80)
                                        )
                                ),
                                0, 0.4),
                        1, 0.3, 2)
        }
)
})
Was passiert hier? Sinuswellen bubblen nach oben. (09.10.2021)

Bubbles in Clustern#

Quelle: Kapitel 7 aus Einsteiger-Youtube-Tutorial von Eli Muveil Fieldsteeel
(
s.boot;

SynthDef.new(\blip, { // Soundsource
  arg out, fund=300, dens=2, decay=0.2;
  var freq, trig, sig;
  freq = LFNoise0.kr(3).exprange(fund,fund*4).round(fund);
  sig = SinOsc.ar(freq) * 0.25;
  trig = Dust.kr(dens);
  sig = sig * EnvGen.kr(Env.perc(0.01, 0.3), trig);
  sig = Pan2.ar(sig, LFNoise1.kr(10));
  Out.ar(out, sig);
}).add;
//)

SynthDef.new(\reverb, { // Soundeffect
  arg in, out=0;
  var sig;
  sig = In.ar(in, 2);
  sig = FreeVerb.ar(sig, 0.5, 0.8, 0.2);
  Out.ar(out, sig);
}).add;
//)

~sourceGrp = Group.new;
~fxGrp = Group.after(~sourceGrp);

y = Synth.new(\reverb, [\in, ~reverbBus2], ~fxGrp);

8.do{
  Synth.new(
    \blip,
    [
      \out, ~reverbBus2,
      \fund, exprand(60,300).round(30)
    ],
    ~sourceGrp
  );
}
)

Was passiert hier? Voll die Bubbles in Clustern (09.10.2021)

Moogbasstone#

Quelle: https://github.com/everythingwillbetakenaway/Synthdefs
s.waitForBoot{
//no use of gate, fixed length
SynthDef(\moogbasstone2,{|out= 0 freq = 440 amp = 0.1 gate=1 attackTime= 0.2 fenvamount=0.5 cutoff= 1000 gain=2.0 pan=0.0|

        var osc, filter, env, filterenv;

        //alternative: richer source
        osc = Mix(Pulse.ar(freq.lag(0.05)*[1.0,1.001,2.0],Rand(0.45,0.5)!3,0.33));

        filterenv = EnvGen.ar(Env.adsr(attackTime,0.0,1.0,0.2),gate,doneAction:2);
        filter =  MoogFF.ar(osc,cutoff*(1.0+(fenvamount*filterenv)),gain);

        env = EnvGen.ar(Env.adsr(0.001,0.3,0.9,0.2),gate,doneAction:2);

        Out.ar(out,Pan2.ar((0.7*filter+(0.3*filter.distort))*env*amp,pan));

}).add;

//via Comb filter for feedback
SynthDef(\delayeffect, {|out =0 gate= 1|
        var source = In.ar(out,2);
        var delay;
        var env = Linen.kr(gate, 0.1, 1, 0.1, 2);

        delay= CombC.ar(source,0.25,0.25,2.0);

        XOut.ar(out,env, delay);

}).add;


SynthDef(\choruseffect, {|out =0 gate= 1|
        var source = In.ar(out,2);
        var chorus;
        var env = Linen.kr(gate, 0.1, 1, 0.1, 2);

        chorus= Mix.fill(7, {

                var maxdelaytime= rrand(0.005,0.02);

                DelayC.ar(source, maxdelaytime,LFNoise1.kr(Rand(4.5,10.5),0.25*maxdelaytime,0.75*maxdelaytime) )

        });

        XOut.ar(out,env, chorus);

}).add;

(
Pfx(
        Pfx(
                Pmono(
                        \moogbasstone2,
                        \amp, 0.8,
                        \midinote,Pseq([24,36,43,48, 43,48,36,36, 36,36,39,36, 31,31,31,31, 31,34,31,34],inf),
                        \dur,0.25,
                        \gain,Pn(Pseries(2,0.1,19),inf),
                        \cutoff,Pstutter(3,Pn(Pseries(50,250,40),inf)),
                        \attackTime,Pn(Pseries(0.0,0.01,30),inf),
                        \fenvamount,Pstutter(4,Pn(Pseries(0.0,0.05,20),inf))
                ),
                \delayeffect
        ),
        \choruseffect
).play

)

}

Was passiert hier? Moog-Synthesizer als Sequenz mit autostart des Supercollider-Servers (09.10.2021)

Chimes#

Quelle: https://depts.washington.edu/dxscdoc/Help/Tutorials/A-Practical-Guide/PG_Cookbook05_Using_Samples.html|Pattern-Guide-Cookbook, Chapter 5, "Using Patterns"
(
TempoClock.default.tempo = 1;
p = Pbind(
    \instrument, \multiSampler,
    \bufBase, b.first,
    \baseFreqBuf, ~baseBuf,
    \degree, Pseries(0, Prand(#[-2, -1, 1, 2], inf), inf).fold(-11, 11),
    \dur, Pwrand([0.25, Pn(0.125, 2)], #[0.8, 0.2], inf),
    \amp, Pexprand(0.1, 0.5, inf),
    // some important conversions
    // identify the buffer numbers to read
    \freq, Pfunc { |ev| ev.use(ev[\freq]) },
    \bufnum, Pfunc({ |ev| ~midinotes.indexInBetween(ev[\freq].cpsmidi) })
    .clip(0, ~midinotes.size - 1.001)
).play;
)

Was apssiert hier: Ähnlich einem Zitter- oder Harfenspiel werden hier Töne angeschlagen (09.10.2021)

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-14) was last changed on 03-Sep-2022 21:00 by Markus Monderkamp