[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] Merry Christmas!



// Winter Blunderland (Shalmaneser, 2016)
// With apologies to Felix Bernard
// Audio at <http://doubtfulpalace.com/artists/Holiday>

(
Server.default.waitForBoot {

    var levelScale = { |numOscs| ((numOscs.log2 + 1) * -3.01).dbamp };
var freqDrift = { |freq, rate=0.2, max=0.1| LFDNoise3.ar(rate, max, freq.cpsmidi).midicps };
    var tempo, clock, tempoComp;
var melody_default_entry, melody_default_entry2, bridge_default_entry, melody_verse_base, melody_specs, melody_spec;
    var verse_func, bridge_func, bass_verse_func, bass_bridge_func;
var bass_verse_default_entry, bass_bridge_default_entry, bass_verse_base, bass_specs, bass_spec;
    var score, kick, hat, chime, out;

var bassProcSynth, bassProcBus, leadProcSynth, leadProcBus, bLeadProcSynth, bLeadProcBus;
    var chimeProcSynth, chimeProcBus, masterizerSynth, masterizerBus;

    SynthDef(\plucksusSubFM, {
        |output = 0, gate = 1.0, release = 0.25, freq = 440, vel = 0.5,
        spread = 0.05, decay = 10, amp=0.5, basecoef = 0.9|
var plucks, plucksum, numOscs = 5, env, num, attack, coef, initphase, attnoise, sub;
        var baseamp, decaymod;
        num = freq.cpsmidi;
        attack = LinExp.kr(vel, 0, 1, 0.05, 0.01);
        coef = LinExp.kr(vel, 0, 1, basecoef, basecoef * 0.9);
        initphase = LinExp.kr(vel, 0, 1, 0, pi);
        attnoise = LinExp.kr(vel, 0, 1, 0.025, 0.05) * 0.25;
        baseamp = LinExp.kr(vel, 0, 1, -18.dbamp, 0.dbamp);
        decaymod = LinExp.kr(vel, 0, 1, 0.5, 1.0);
        plucks = {
            var detune, freq;
detune = LFNoise1.kr(ExpRand(0.1, 0.5)).range(spread.neg, spread);
            freq = (num + detune).midicps;
            DelayN.ar(Pluck.ar(
SinOsc.ar(0.5, initphase) + HPF.ar(WhiteNoise.ar(attnoise), 200),
                Impulse.kr(0),
                (num - 1).midicps.reciprocal,
                freq.reciprocal,
                decay * decaymod,
                coef
            ), 0.01, Rand(0, 0.01))
        } ! numOscs;
env = EnvGen.kr(Env.asr(attack, 1, release, 'linear'), gate: gate, doneAction: 2);
        plucksum = Splay.ar(plucks) * 18.dbamp;
        sub = SinOsc.ar(freqDrift.(freq * 0.5),
            phase: SinOsc.ar(freqDrift.(freq), 0, env * 0.5),
            mul: Amplitude.ar(plucksum) * 3.dbamp).dup;
OffsetOut.ar(output, HPF.ar((plucksum + sub), 80) * env * amp * baseamp);
    }).store.send(s);

    SynthDef(\lead, {
|output=0, gate=1, freq=220, attack=0.05, release=0.05, pitchStartOffset=0, pitchEndOffset=0, pitchDelay=0, pitchAttack=0, pitchHoldTime=1, pitchRelease=0, filtAttack=0.5, amp=0.25|
        var num = freq.cpsmidi;
        var startFreq = (num + pitchStartOffset).midicps;
        var endFreq = (num + pitchEndOffset).midicps;
        var pitchEnv = EnvGen.ar(Env(
            [startFreq, startFreq, freq, freq, endFreq],
            [pitchDelay, pitchAttack, pitchHoldTime, pitchRelease],
            \exponential), gate);
        var pitchEnv2 = EnvGen.ar(Env(
            [freq, freq, freq, freq, endFreq],
            [pitchDelay, pitchAttack, pitchHoldTime, pitchRelease],
            \exponential), gate);
        var filtEnv = EnvGen.ar(Env.asr(filtAttack, 1, release), gate);
var env = EnvGen.ar(Env.asr(attack, 1, release), gate, doneAction: 2);
        var numOscs = 5;
var osc1 = { Pulse.ar( freqDrift.(pitchEnv2), LFTri.ar(ExpRand(0.5, 1)).range(0.1, 0.9)) } ! numOscs;
        var osc2 = { Saw.ar(freqDrift.(pitchEnv, 0.5, 0.15)) } ! numOscs;
        var filt = MoogFF.ar(
([osc1.sum * 0.5, osc2.sum].sum * levelScale.(numOscs) * 20).distort,
            (LinLin.kr(pitchEnv, 20, 20000, 8, 1) * 0.5 + (filtEnv * 2 *
Vibrato.ar(1, rate: 10, depth: 0.5, delay: 0.1, onset: 0.1, rateVariation: 0.2, depthVariation: 0.4))) * pitchEnv,
            3
        );
        OffsetOut.ar(output, filt.dup * env * amp * -4.dbamp)
    }).store.send(s);

    SynthDef(\mewlLead, {
|output=0, gate=1, freq=220, attack=0.05, release=0.05, pitchStartOffset=0, pitchEndOffset=0, pitchDelay=0, pitchAttack=0, pitchHoldTime=1, pitchRelease=0, filtAttack=0.5, amp=0.25|
        var num = freq.cpsmidi;
        var startFreq = (num + pitchStartOffset).midicps;
        var endFreq = (num + pitchEndOffset).midicps;
        var pitchEnv = EnvGen.ar(Env(
            [startFreq, startFreq, freq, freq, endFreq],
            [pitchDelay, pitchAttack, pitchHoldTime, pitchRelease],
            \exponential), gate);
        var pitchEnv2 = EnvGen.ar(Env(
            [freq, freq, freq, freq, endFreq],
            [pitchDelay, pitchAttack, pitchHoldTime, pitchRelease],
            \exponential), gate);
        var filtEnv = EnvGen.ar(Env.asr(filtAttack, 1, release), gate);
var env = EnvGen.ar(Env.asr(attack, 1, release), gate, doneAction: 2);
        var numOscs = 5;
var osc1 = { Pulse.ar(freqDrift.(pitchEnv, 0.1, 0.025), LFTri.ar(ExpRand(0.5, 1)).range(0.3, 0.7)) } ! numOscs;
        var filt = MoogFF.ar(
            osc1.sum * levelScale.(numOscs),
            (LinLin.kr(pitchEnv, 20, 20000, 4, 1) * 0.5 + (filtEnv * 2 *
Vibrato.ar(1, rate: 5, depth: 0.03, delay: 0.1, onset: 0.1, rateVariation: 0.1, depthVariation: 0.2))) * pitchEnv,
            3.5
        );
        OffsetOut.ar(output, filt.dup * env * amp * -2.dbamp)
    }).store.send(s);

    SynthDef(\bLead, {
|output=0, gate=1, attack=0.1, decay=1, release=0.5, freq=220, pitchAttackAmt=2, pitchAttackTime=0.02, amp=0.5| var env = EnvGen.ar(Env.adsr(attack, decay, 0.25, release, curve: [-8, -2, 8]), gate, doneAction: 2); var pitchEnv = EnvGen.ar(Env(({ Rand(pitchAttackAmt.neg, pitchAttackAmt) } ! 10 ++ [0]) + freq.cpsmidi, pitchAttackTime/10 ! 10), gate).midicps;
        var widthEnv = LFTri.ar(0.5).range(0.4, 0.6);
        var osc = Pulse.ar(pitchEnv, widthEnv, env * amp);
        var filt = MoogFF.ar(osc, freq * 12);
        OffsetOut.ar(output, filt.dup * 2.dbamp)
    }).store.send(s);

    SynthDef(\noiseBurst, {
        |out=0, freq=800, gate=1, attack=0.01, release=0.01, amp=0.25|
var env = EnvGen.ar(Env.asr(attack, 1, release), gate, doneAction: 2); OffsetOut.ar(out, Pan2.ar(BPF.ar(WhiteNoise.ar, freq, 0.5), LFTri.ar(ExpRand(15, 30)), amp * 12.dbamp * env))
    }).store.send(s);

    SynthDef(\kick, {
        |out=0, freq=220, gate=1, vel=0.5, amp=0.25|
var env = EnvGen.ar(Env.perc(0.005, 0.25), gate, levelScale: LinLin.kr(vel, 0, 1, 0.25, 1), doneAction: 2); OffsetOut.ar(out, (Blip.ar(3, LinExp.kr(vel, 0, 1, 25, 100), 2) + SinOsc.ar(Line.kr(80, 60, 0.05), vel * pi)).dup * env * amp)
    }).store.send(s);

    SynthDef(\hat, {
        |output=0, freq=440, gate=1, vel=0.5, amp=0.0625|
        var baseEnv = EnvGen.ar(Env.perc(0.005, 0.5, curve: -16), gate);
var env = EnvGen.ar(Env.adsr(0.01, 0.2, 0.8, 0.25), gate, doneAction: 2);
        var mod = ({ ExpRand(2, 6)  } ! 5).collect { |mult, i|
            SinOsc.ar(freqDrift.(freq * mult, 0, baseEnv / (i+1))) }.sum;
var osc = SinOsc.ar(freq, mod + HPF.ar(WhiteNoise.ar(3.dbamp), freq)); //* baseEnv;
        var filt = HPF.ar(osc, LinExp.ar(env, 0, 1, 200, 2000));
OffsetOut.ar(output, Pan2.ar(filt, Rand(-1, 1), env * baseEnv * amp))
    }).store.send(s);

SynthDef(\chime, { |output=0, gate=1, freq=440, vel=0.5, amp=1, attack=0.005, decay = 0.1, sustain=0.5, release = 0.2|
        var attackMod = LinExp.kr(vel, 0, 1, 2.0, 0.5);
        var ampMod = LinExp.kr(vel, 0, 1, -12.dbamp, 1);
        var mod1Env = EnvGen.ar(Env.perc(0.01 * attackMod, decay * 0.5));
        var mod2Env = EnvGen.ar(Env.perc(0.02 * attackMod, decay * 0.25));
var bodyEnv = EnvGen.ar(Env.perc(attack * attackMod, decay), doneAction: 2);
        var osc = { |i|
            SinOsc.ar(
                freqDrift.(freq * 2),
                SinOsc.ar(
                    freqDrift.(freq * 2) * 1.5,
SinOsc.ar(freqDrift.(freq * 2) * 11/7, i * pi/2, mul: mod1Env),
                    mul: mod2Env
                ),
                mul: bodyEnv * 0.25
            )
        } ! 4;
        var sig = Splay.ar(osc);
        OffsetOut.ar(output, osc * bodyEnv * amp * ampMod * -1.dbamp);
    }).store.send(s);

    SynthDef(\bassProc, { |in=0, out=0, gate=1, wet=0.25|
        var sig = In.ar(in, 2);
var processed = GVerb.ar(sig.sum, 30, revtime: 1.5, drylevel: 0, taillevel: wet, earlyreflevel: wet * 1.25);
        var releaser = DetectSilence.ar(gate + processed, doneAction: 2);
        Out.ar(out, sig + processed);
    }).store.send(s);

    SynthDef(\chimeProc, { |in=0, out=0, gate=1, wet=0.25|
        var sig = In.ar(in, 2);
var processed = GVerb.ar(sig.sum, 300, revtime: 3.0, drylevel: 0, taillevel: wet, earlyreflevel: wet * 0.25);
        var releaser = DetectSilence.ar(gate + processed, doneAction: 2);
        Out.ar(out, sig);
    }).store.send(s);

    SynthDef(\leadProc, { |in=0, out=0, gate=1, wet=0.25|
        var sig = In.ar(in, 2);
        var rate = 116/60 * 4;
var processed = CombC.ar(sig.dup, 0.04, { LFNoise1.kr(rate).range(0.28, 0.32) } ! 2, 0.09, mul: wet);
        var releaser = DetectSilence.ar(gate + processed, doneAction: 2);
        Out.ar(out, sig + processed);
    }).store.send(s);

    SynthDef(\bLeadProc, { |in=0, out=0, gate=1, wet=0.25|
        var local, processed, releaser;
        var sig = In.ar(in, 2);
        var base = 60/116 * 0.5;
        var numDelays = 3;
        var maxDelayTime = base * 0.95.reciprocal;
        var minDelayTime = base * 0.95;
        var feedback = 0.75;
        var threshold = 0.001;
        var width = 0.1;
        var rate = 0.25;
        local = LocalIn.ar(numDelays * 2) * feedback;
local = OnePole.ar(PitchShift.ar(local, pitchRatio: LFNoise1.kr(rate).exprange(width.neg.midiratio, width.midiratio)), 0.9);
        numDelays.do({
            |i|
            var left = sig[0] + local[i * 2];
            var right = sig[1] + local[(i * 2) + 1];
            var trig = Trig.ar(Amplitude.ar(left + right).neg + threshold);
            local[i * 2] =
            DelayN.ar(left, maxDelayTime,
                Lag.ar(TExpRand.ar(minDelayTime, maxDelayTime, trig)));
            local[(i * 2) + 1] =
            DelayN.ar(right, maxDelayTime,
                Lag.ar(TExpRand.ar(minDelayTime, maxDelayTime, trig)));
        });
        local = LeakDC.ar(local);
        LocalOut.ar(local);
        processed = Mix.fill(numDelays, {
            |i|
            [local[i * 2], local[(i * 2) + 1]]
        });
        releaser = DetectSilence.ar(gate + processed, doneAction: 2);
        Out.ar(out, sig + (processed * wet));
    }).store.send(s);

    SynthDef(\masterizer, {
        |in=0, out=0, gate=1|
        var sig = In.ar(in, 2);
        var driven = (sig * 4.dbamp).softclip;
        var protected = HPF.ar(HPF.ar(driven, 45), 45);
        var limited = Limiter.ar(protected * 5.dbamp, -0.3.dbamp);
        var releaser = DetectSilence.ar(gate + limited, doneAction: 2);
        Out.ar(out, limited);
    }).store.send(s);

    Server.default.sync;

    out = 0;
    tempo = 116/60;
    tempoComp = tempo.reciprocal;
    clock = TempoClock(tempo);

    masterizerBus = Bus.audio(numChannels: 2);

    bassProcBus = Bus.audio(numChannels: 2);
    bassProcSynth = Synth(\bassProc, [
        \in, bassProcBus, \out, masterizerBus, \wet, -30.dbamp
    ], addAction: \addToTail).onFree({ bassProcBus.free });
    chimeProcBus = Bus.audio(numChannels: 2);
    chimeProcSynth = Synth(\bassProc, [
        \in, chimeProcBus, \out, masterizerBus, \wet, -30.dbamp
    ], addAction: \addToTail).onFree({ chimeProcBus.free });
    leadProcBus = Bus.audio(numChannels: 2);
    leadProcSynth = Synth(\leadProc, [
        \in, leadProcBus, \out, masterizerBus, \wet, -6.dbamp
    ], addAction: \addToTail).onFree({ leadProcBus.free });
    bLeadProcBus = Bus.audio(numChannels: 2);
    bLeadProcSynth = Synth(\bLeadProc, [
        \in, bLeadProcBus, \out, masterizerBus, \wet, -18.dbamp
    ], addAction: \addToTail).onFree({ bLeadProcBus.free });
    bLeadProcBus = Bus.audio(numChannels: 2);
    bLeadProcSynth = Synth(\bLeadProc, [
        \in, bLeadProcBus, \out, masterizerBus, \wet, -18.dbamp
    ], addAction: \addToTail).onFree({ bLeadProcBus.free });
    masterizerSynth = Synth(\masterizer, [
        \in, masterizerBus, \out, out
    ], addAction: \addToTail).onFree({ masterizerBus.free });

// degree, dur, legato, pitchDelay, pitchAttack, pitchStartOffset, pitchHoldTime, pitchRelease, pitchEndOffset, instrument
    melody_default_entry = [nil, nil, 0.75, 0, 0, 0, 1, 0, 0, \mewlLead];
    melody_default_entry2 = [nil, nil, 0.75, 0, 0, 0, 1, 0, 0, \lead];

    // degree, dur, legato, release, instrument
    bridge_default_entry = [nil, nil, 0.75, 0.5, 2, 0.08, \bLead];

    melody_verse_base = [
[4, 2.625, 0.75, 0, 0.25, -2], [4, 0.5, 0.5, 0, 0.25, -2], [4, 0.5, 0.5, 0, 0.25, -2], [4, 2.5, 0.75, 0.25, 1, -3], [4, 0.5, 0.5, 0, 0.25, -2], [4, 0.5, 0.5, 0, 0.25, -2],
        [4, 2.5], [4, 0.5, 0.5, 0, 0.25, -2], [4, 0.5, 0.5, 0, 0.25, -2],
        [4, 2.5, 0.75, 0.25, 1, -2], [\rest, 0.5], [5, 0.5],
[6, 0.5, 0.5, 0, 0.25, -2], [6, 0.5, 0.5, 0, 0.25, -2], [6, 1, 1, 0, 0, 0, 0.75, 0.125, 3], [5, 1], [5, 0.5], [4, 0.5, 0.5, 0, 0.25, -1], [4, 0.5, 0.5, 0, 0.25, -1], [4, 1, 1, 0, 0, 0, 0.75, 0.125, -3], [3, 1], [3, 0.5], [2, 0.5, 0.5, 0, 0.25, -2], [2, 0.5], [2, 0.5, 0.5, 0, 0.25, -2], [2, 0.5], [1, 0.25], [1, 0.25], [1, 0.5], [1, 0.5],
    ];

    melody_specs = [
[[[4, 2.0, 1.0, 0, 0.25, -2, 1.25, 0.75, -12], [4, 2.0, 1.0, 0, 0.25, -2, 1.25, 0.75, -12]] ++ melody_verse_base ++ [[0, 2, 1, 0, 0.25, -1], [\rest, 0.5]], melody_default_entry], [[[4, 0.5, 0.5, 0, 0.25, -2], [4, 0.5, 0.5, 0, 0.25, -2]] ++ melody_verse_base ++ [[0, 3.875, 1, 0, 0.25, -1, 2, 1.875, 12]], melody_default_entry2],
        // bridge
        [[
            [-2, 2/3], [-2, 1/3], [3s, 2/3], [3s, 1/3],
            [-1, 2/3], [-1, 1/3], [4, 2/3], [4, 1/3, 1, 0.001],
            [14, 1, 1, 0.001, 2, 0.04, \noiseBurst], [3s, 2/3], [1, 4/3],
            [-2, 2/3], [-2, 1/3], [3s, 2/3], [3s, 1/3],
            [-1, 2/3], [-1, 1/3], [4, 2/3], [4, 1/3, 1, 0.001],
            [16, 1, 1, 0.001, 2, 0.04, \noiseBurst], [3s, 6/3],
            [0, 2/3], [0, 1/3], [5, 2/3], [5, 1/3],
            [2, 2/3], [2, 1/3], [7, 2/3], [7, 1/3, 1, 0.0001],
[18, 1, 1, 0.001, 2, 0.04, \noiseBurst], [6, 2/3], [4, 6/3], [5, 1/3],
            [6, 0.5], [6, 0.5], [4, 0.5], [4, 0.5],
            [5, 0.5], [5, 0.5], [1, 0.5], [1, 0.5],
        ], bridge_default_entry],
[[[4, 7.75, 1.5, 0, 0, 0, 1, 3, -36], [4, 2.0, 1.0, 0, 0.25, -2, 1.25, 0.75, -12], [4, 2.0, 1.0, 0, 0.25, -2, 1.25, 0.75, -12]]
            ++ melody_verse_base ++ [
[0, 2, 1, 0, 0.25, -1], [19, 1.375, 1, 0, 0, 0, 1, 0, 0, \noiseBurst], [2, 0.625, 0.5, 0, 0.25, -2], [2, 0.5], [2, 0.5, 0.5, 0, 0.25, -2], [2, 0.5], [1, 0.25], [1, 0.25], [1, 0.5], [1, 0.5], [0, 2, 1, 0, 0.25, -1], [21, 1.375, 1, 0, 0, 0, 1, 0, 0, \noiseBurst], [2, 0.625, 0.5, 0, 0.25, -2], [2, 0.5], [3, 0.5, 0.5, 0, 0.25, -2], [3, 0.5], [4, 0.25], [4, 0.25], [5, 0.5], [6, 0.5],
                [7, 2, 1, 0, 0.25, -1],
        ], melody_default_entry2]
    ].collect { |spec|
spec[0].collect { |entry| spec[1].collect { |item, i| entry[i] ? item } }
    }.collect(_.flop);

    verse_func = { |spec|
        var smin = 0.95;
        var smax = smin.reciprocal;
        Pbind(
            \scale, Scale.major,
            \degree, Pseq(spec[0], 1),
            \dur, Pseq(spec[1], 1),
            \legato, Pbinop( '*', Pseq(spec[2], 1), Pexprand(smin, smax)),
\pitchDelay, Pbinop( '*', Pseq(spec[3] * tempoComp, 1), Pexprand(smin, smax)), \pitchAttack, Pbinop( '*', Pseq(spec[4] * tempoComp, 1), Pexprand(smin, smax)),
            \pitchStartOffset, Pseq(spec[5], 1),
\pitchHoldTime, Pbinop( '*', Pseq(spec[6] * tempoComp, 1), Pexprand(smin, smax)), \pitchRelease, Pbinop( '*', Pseq(spec[7] * tempoComp, 1), Pexprand(smin, smax)),
            \pitchEndOffset, Pseq(spec[8], 1),
            \instrument, Pseq(spec[9], 1),
            \octave, 5,
            \root, 7,
            \amp, -21.dbamp,
            \output, leadProcBus,
        )
    };

    bridge_func = { |spec|
        var smin = 0.95;
        var smax = smin.reciprocal;
        Pbind(
            \scale, Scale.major,
            \degree, Pseq(spec[0], 1),
            \dur, Pseq(spec[1], 1),
            \legato, Pseq(spec[2], 2),
\release, Pbinop('*', Pseq(spec[3] * tempoComp, 1), Pexprand(smin, smax)),
            \pitchAttackAmt, Pseq(spec[4], 1),
\pitchAttackTime, Pbinop('*', Pseq(spec[5] * tempoComp, 1), Pexprand(smin, smax)),
            \instrument, Pseq(spec[6], 1),
            \octave, 5,
            \root, 7,
            \amp, -21.dbamp,
            \output, bLeadProcBus,
        )
    };

    bass_verse_default_entry = [nil, nil, 0.5, 2, -6.dbamp];

    bass_bridge_default_entry = [nil, nil, 0.5, 0.8, -3.dbamp];

    bass_verse_base = [
        [0, 0.5, 1], [0, 0.5, 0.5], [-3, 0.5, 1], [-1, 0.5, 0.5],
[0, 0.25, 1], [0, 0.25, 1/6], [1, 0.25, 1/3], [1, 0.25, 0.5], [2, 0.25, 2/3], [2, 0.25, 5/6],
        [0, 0.5, 1], [0, 0.5, 0.5], [-3, 0.5, 1], [-1, 0.5, 0.5],
[0, 0.25, 1], [0, 0.25, 1/6], [-1, 0.25, 1/3], [-1, 0.25, 0.5], [-2, 0.25, 2/3], [-2, 0.25, 5/6],

        [-3, 0.5, 1], [-3, 0.5, 0.5], [-6, 0.5, 1], [-4, 0.5, 0.5],
[-3, 0.25, 1], [-3, 0.25, 1/6], [-2, 0.25, 1/3], [-2, 0.25, 0.5], [-1, 0.25, 2/3], [-1, 0.25, 5/6],
        [-3, 0.5, 1], [-3, 0.5, 0.5], [-6, 0.5, 1], [-4, 0.5, 0.5],
[-3, 0.25, 1], [-3, 0.25, 1/6], [-2, 0.25, 1/3], [-2, 0.25, 0.5], [-1, 0.25, 2/3], [-1, 0.25, 5/6],

        [-3, 0.5, 1], [-3, 0.5, 0.5], [-6, 0.5, 1], [-5, 0.5, 0.5],
[-4, 0.25, 1], [-4, 0.25, 1/6], [-2, 0.25, 1/3], [-2, 0.25, 0.5], [-4, 0.25, 2/3], [-4, 0.25, 5/6],
        [-5, 0.5, 1], [-5, 0.5, 0.5], [-8, 0.5, 1], [-7, 0.5, 0.5],
[-6, 0.25, 1], [-6, 0.25, 1/6], [-4, 0.25, 1/3], [-4, 0.25, 0.5], [-3, 0.25, 2/3], [-3, 0.25, 5/6],

        [-2, 0.5, 1], [-2, 0.5, 0.5], [-5, 0.5, 1], [-4, 0.5, 0.5],
[-3, 0.25, 1], [-3, 0.25, 1/6], [-2, 0.25, 1/3], [-2, 0.25, 0.5], [-1, 0.25, 2/3], [-1, 0.25, 5/6],


    ];

    bass_specs = [
[[[\rest, 2.125, 0], [\rest, 2, 0]] ++ bass_verse_base ++ [[0, 2.5, 1]], bass_verse_default_entry], [[[\rest, 1.125]] ++ bass_verse_base ++ [[0, 3.875, 1, 8]], bass_verse_default_entry],
        [[
            [1, 2/3, 1], [1, 1/3, 0.5], [-2, 2/3, 1], [-2, 1/3, 0.5],
            [-3, 2/3, 1], [-3, 1/3, 0.5], [-1, 2/3, 1], [-1, 1/3, 0.5],
[\rest, 1, 0], [1, 2/5, 1], [-4s, 2/5, 1], [-3, 2/5, 1], [-2, 2/5, 1], [0, 2/5, 1],
            [1, 2/3, 1], [1, 1/3, 0.5], [-2, 2/3, 1], [-2, 1/3, 0.5],
            [-3, 2/3, 1], [-3, 1/3, 0.5], [-1, 2/3, 1], [-1, 1/3, 0.5],
[\rest, 1, 0], [1, 2/5, 1], [0, 2/5, 1], [-1, 2/5, 1], [-2, 2/5, 1], [-3, 2/5, 1],
            [-4, 2/3, 1], [-4, 1/3, 0.5], [-2, 2/3, 1], [-2, 1/3, 0.5],
            [0, 2/3, 1], [0, 1/3, 0.5], [-1, 2/3, 1], [-2, 1/3, 0.5],
            [\rest, 1, 0],
[-3, 0.25, 1, 0.5, -2.dbamp], [-3, 0.25, 0.75, 0.5, -2.dbamp], [-3, 0.25, 0.75, 0.5, -2.dbamp], [-3, 0.25, 0.75, 0.5, -2.dbamp], [-2, 0.25, 1, 0.5, -2.dbamp], [-2, 0.25, 0.75, 0.5, -2.dbamp], [-2, 0.25, 0.75, 0.5, -2.dbamp], [-2, 0.25, 0.75, 0.5, -2.dbamp], [-1, 0.25, 1, 0.5, -2.dbamp], [-1, 0.25, 0.75, 0.5, -2.dbamp], [-1, 0.25, 0.75, 0.5, -2.dbamp], [-1, 0.25, 0.75, 0.5, -2.dbamp],
            [-3, 0.5, 1], [-3, 0.5, 1], [-1, 0.5, 1], [-1, 0.5, 1],
            [1, 0.5, 1], [1, 0.5, 1], [3s, 0.5, 1], [3s, 0.5, 1],
        ], bass_bridge_default_entry],
[[[4, 7.75, 1, 10], [\rest, 2.125, 0], [\rest, 2, 0]] ++ bass_verse_base ++ [
            [0, 2, 1, 4], [-3, 1.5, 1, 3],
            [-2, 0.5, 1], [-2, 0.5, 0.5], [-5, 0.5, 1], [-4, 0.5, 0.5],
[-3, 0.25, 1], [-3, 0.25, 1/6], [-2, 0.25, 1/3], [-2, 0.25, 0.5], [-1, 0.25, 2/3], [-1, 0.25, 5/6],
            [0, 2, 1, 4], [-3, 1.5, 1, 3],
            [-2, 0.5, 1], [-2, 0.5, 0.5], [-5, 0.5, 1], [-4, 0.5, 0.5],
[-3, 0.25, 1], [-3, 0.25, 1/6], [-6, 0.25, 1/3], [-6, 0.25, 0.5], [-3, 0.25, 2/3], [-3, 0.25, 5/6], [0, 0.5, 1], [-4, 0.5, 0.5], [-3, 0.5, 1], [-5, 0.5, 0.5], [-7, 0.5, 1]
        ], bass_verse_default_entry]
    ].collect { |spec|
spec[0].collect { |entry| spec[1].collect { |item, i| entry[i] ? item } }
    }.collect(_.flop);

    bass_verse_func = { |spec|
        Pbind(
            \scale, Scale.major,
            \instrument, \plucksusSubFM,
            \degree, Pseq(spec[0], 1),
            \dur, Pseq(spec[1], 1),
            \vel, Pseq(spec[2], 1),
            \decay, Pseq(spec[3] * tempoComp, 1),
            \amp, Pseq(spec[4], 1),
            \octave, 4,
            \root, 7,
            \output, bassProcBus
        )
    };

    bass_bridge_func = bass_verse_func;

    kick = Pbindf(Pseq([
        Pbind(\degree, \rest, \dur, Pseq([7.75 + 4.125], 1)),
        Pbind(\degree, 0, \dur, Pseq([1], 21)),
Pbind(\degree, 0, \dur, Pseq([1, 1, 1, 0.5, 2] ++ (0.125 ! 12), 2)),
        Pbind(\degree, 0, \dur, Pseq([1, 1, 1, 0.5, 1], 1))
    ]), \amp, -12.dbamp, \legato, 0.1, \vel, 1, \instrument, \kick);

    hat = Pbindf(Pseq([
        Pbind(\freq, \rest, \dur, Pseq([7.75 + 4.125 + 0.5], 1)),
        Pbind(\midinote, 103, \dur, Pseq([1], 21)),
Pbind(\midinote, Pseq([103, 103, 103, \rest], 3), \dur, Pseq([1, 1, 1, 4], 3)), ]), \output, bLeadProcBus, \instrument, \hat, \legato, 0.025, \amp, -20.dbamp, \vel, 1
    );

    chime = Pbindf(Pseq([
        Pbind(
            \degree, Pseq([\rest, -7, -6, -5, -4,  -3, -2, 0, 1]),
            \dur, Pseq([0.25] ++ (0.125 ! 8)),
            \vel, Pseq([0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85]),
            \amp, -18.dbamp,
            \octave, 6,
            \decay, 1.0,
        ),
        Pbind(
            \degree, Pseq([
                2, 2, 2, 7, 6, 4, -7, -6, -5, -4,  -3, -2, 0, 1,
                2, 2, 2, 7, 6, 4, -7, -6, -5, -4,  -3, -2, 0, 1,
                1, 1, 1, 6, 3, 4, -8, -7, -6, -5,  -4, -3, -1, 0,
                1, 1, 1, 6, 3, 4, -7, -6, -5, -4,  -3, -2, 0, 1,
                0, -2, -1, 0, 3, 2, 1, 2,
                3, 0, 2, 3, 5, 4, 2, 4,
                7, 6, 5, 4, 3, 4, 6, 8,
                9, 8, 7, 6, 4, 3, 2, 1,
                0, -1, -2, -3, -4, -5, -6, -7

            ]),
            \dur, Pseq([
                Pseq([0.5, 0.25, 0.25, 0.5, 0.5, 0.5] ++ (0.125 ! 8), 4),
                Pseq([0.5, 0.25, 0.25, 0.5, 0.5, 0.5, 0.5, 0.5], 3),
                Pseq([0.25], 16)
            ]),
            \vel, Pseq([
Pseq([1, 0.75, 0.6, 1, 0.8, 1, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85], 4),
                Pseq([1.0, 0.8, 0.6, 1.0, 0.8, 1.0, 0.8, 1.0], 3),
                Pseq([1.0, 0.6, 0.8, 0.6], 4),
            ]),
            \amp, Pseq(((-23 ! 80) ++ (-19 ! 16)).dbamp, 1),
            \octave, 5,
            \decay, Pexprand(0.8, 1.25),
        )
]), \scale, Scale.major, \instrument, \chime, \legato, 0.1, \attack, 0.05, \root, 7, \output, chimeProcBus);

    score = Pseq([
        Pbindf(
            Pseq([
Ppar([verse_func.(melody_specs[0]), bass_verse_func.(bass_specs[0])], 1), Ppar([verse_func.(melody_specs[1]), bass_verse_func.(bass_specs[1]), chime], 1), Ppar([bridge_func.(melody_specs[2]), bass_bridge_func.(bass_specs[2])], 1), Ppar([verse_func.(melody_specs[3]), bass_verse_func.(bass_specs[3]), kick, hat], 1),
            ], 1),
            \out, masterizerBus
        ),
Pfunc({ [bassProcSynth, leadProcSynth, bLeadProcSynth, chimeProcSynth, masterizerSynth].do(_.release); nil }),
    ]);

    p = score.play(clock);
}
)

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/