«critters» by snappizz

on 14 Apr'18 17:35 in glitchadditive synthesis
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(
SynthDef(\critter, {
    var snd, numHarmonics, harmonics, shift, sampleRate, shape;
    shift = \shift.kr(0);
    numHarmonics = 50;
    harmonics = numHarmonics.collect { |n| 2 ** (n / 8) + shift };
    snd = FSinOsc.ar(\freq.kr(440) * harmonics * XLine.kr(2, 1, 0.002), { Rand(0, 2pi) } ! numHarmonics);
    snd = snd.sum / snd.size.sqrt;
    snd = snd + DelayC.ar(snd, 0.002, 0.002 * SinOsc.kr(2, Rand(0, 2pi)).linlin(-1, 1, 0, 1));
    snd = BPF.ar(snd, [\resFreq1.kr(1000), \resFreq2.kr(1000)], 0.2).sum;
    sampleRate = \sampleRate.kr(8000);
    snd = LPF.ar(Latch.ar(LPF.ar(snd, sampleRate / 2), Impulse.ar(sampleRate)), sampleRate / 2);
    snd = snd * Env.linen(5e-4, \sustain_.kr(1), 1e-3).ar(Done.freeSelf);
    shape = \shape.kr(0);
    snd = snd * Line.kr((shape * 60).min(0), (shape * -60).min(0), \sustain_.kr(1)).dbamp;
    snd = Pan2.ar(snd, \pan.kr(0));
    Out.ar(\out.kr(0), snd * \amp.kr(0.1));
}).add;
)

(
Pbind(*[
    instrument: \critter,
    dur: Pwrand([Pwhite(0.01, 0.08, 8), Pwhite(0.3, 0.9, 1)], [0.6, 0.4], inf),
    legato: Pwhite(0.2, 0.9, inf),
    sustain_: Pkey(\dur) * Pkey(\legato),
    freq: Pexprand(30, 500, inf),
    shift: Pwhite(-1.0, 1.0, inf),
    resFreq1: Pexprand(100, 10e3, inf),
    resFreq2: Pexprand(100, 10e3, inf),
    pan: Pwhite(-0.8, 0.8, inf),
    sampleRate: Pexprand(4000, Server.default.sampleRate * 0.9),
    shape: Pwrand([-1, 0, 1], [2, 5, 5].normalizeSum, inf),
    amp: -20.dbamp,
]).play;
)
raw 1497 chars (focus & ctrl+a+c to copy)
reception
comments