Smol or mid-sized snippets of SuperCollider code that start in SuperCollider's Workspace Emacs buffer from scratch.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

113 lines
3.2 KiB

// =====================================================================
// SuperCollider Workspace 20.FEB 2021
// =====================================================================
(
Server.default.waitForBoot { fork {
~revBus.free;
~revFx.free;
s.sync;
~revBus = Bus.audio(s, 2);
SynthDef(\bet, { |gate = 1, freq = 234, out = 0, pan = 0, amp = 0.1, cutoff = 4000 |
var snd, env, fenv;
freq = [freq, freq * 1.01] * Rand(0.995, 1.0);
freq = freq * SinOsc.kr(5).range(0.99, 1.01);
env = EnvGen.ar(Env.asr(0, 1, 3), gate, doneAction:2);
fenv = EnvGen.ar(Env.adsr(0.05, 0.5, 0.4, 2), gate);
snd = SinOsc.ar(freq);
snd = snd + Pulse.ar(freq * 0.5, mul:0.8);
snd = snd + LFTri.ar(freq * [1,2].choose * 1.01, mul:1);
snd = LPF.ar(snd, cutoff * fenv + 100);
snd = snd * env * amp;
snd = Balance2.ar(snd[0], snd[1], pan, 0.7);
Out.ar(out, snd);
}).add;
SynthDef(\revfx, { |inBus, outBus = 0, wet = 0.3, amp = 0.2|
var snd, rev;
snd = In.ar(inBus, 2);
snd = BHiShelf.ar(snd, 5000, db:-3);
rev = GVerb.ar(snd, 100, taillevel:wet);
rev = rev * amp;
Out.ar(outBus, rev);
}).add;
s.sync;
~revFx = Synth(\revfx, [\inBus, ~revBus, \amp, 0.4, \wet, 0.4], addAction:\addAfter);
s.sync;
Pbindef(\betP, *[
instrument: \bet,
dur: Prand((1..10), inf) * 0.03 + 1/4 * 0.8,
// from Ichika Nito - Arpeggio //
note: Pseq([
-3, 13, 15, 20, 16, Rest(), // Dbm(add9)/A
-3, 12, 18, 23, 16, Rest(), // Am69
-4, 6, 11, 15, 16, Rest(), // EM9/Ab
-4, 6, 13, 15, 16, Rest(), // Ab7sus4(-13(
-6, 6, 9, 13, 20, Rest(), // Gbm(add9)
-4, 8, 12, 18, 16, Rest(), // Abaug7
1, 13, 15, 20, 16, Rest(), // Dbm(add9)
-1, 11, 15, 20, 16, Rest(), // EM7/B
-3, 13, 15, 20, 16, Rest(), // Dbm(add9)/A
-3, 12, 18, 23, 25, Rest(), // Gbsus4(+11)/A
-6, 6, 9, 13, 20, Rest(), // Gbm(add9)
-4, 3, 6, 11, 15, 20, // Abm7 // 12*6
], inf),
octave: Pseq([
Prand([[5,4],[5,6],[4,5,6]]),
Pn(Pwrand([5,6],[0.7,0.3]), 5)
], inf),
legato: Pseq([4, Pn(Prand((2..5)*0.2),5)],inf),
cutoff: Prand((1..4),inf) *
Pseg([50, 1000, 1000, 50, 10], [60, 60, 30, 20], \cub),
amp: Pseg([0, 0.1, 0.1, 0.01, 0], [10, 120, 30, 10], \cub),
out: ~revBus,
pan: Prand((0..10)-5*0.1, inf)
]).play
}}
)
// notes:
/*
// Db Eb Fb E# Gb Ab Bb Cb
// C C# D D# E F F# G G# A A# B C
// 0 1 2 3 4 5 6 7 8 9 10 11 12
// guitar strings
// E A D G B E
// -8 -3 2 7 11 16
// guitar strings
// E A D G B E
// -8, -3, 2, 7, 11, 16
// taken from Ichika Nito - Arpeggio
-3, 2+11, 7+8, 11+9, 16, Rest(), // Dbm(add9)/A
-3, 2+10, 7+11, 11+12, 16, Rest(), // Am69
-8+4, 2+4, 7+4, 11+4, 16 , Rest(), // EM9/Ab
-8+4, 2+4, 7+6, 11+4, 16 , Rest(), // Ab7sus4(-13(
-8+2, 2+4, 7+2, 11+2, 16+4, Rest(), // Gbm(add9)
-8+4, 2+6, 7+5, 11+7, 16, Rest(), // Abaug7
-8+9, 2+11, 7+8, 11+9, 16, Rest(), // Dbm(add9)
-8+7, 2+9, 7+8, 11+9, 16, Rest(), // EM7/B
-3, 2+11, 7+8, 11+9, 16, Rest(), // Dbm(add9)/A
-3, 2+10, 7+11, 11+12, 16+9, Rest(), // Gbsus4(+11)/A
-8+4, -3+6, 2+4, 7+4, 11+4, 16+4, // Abm7
*/