Skip to content

Instantly share code, notes, and snippets.

@hamoid
Last active August 2, 2016 19:42
Show Gist options
  • Save hamoid/a094f8b6b7788e0672e2 to your computer and use it in GitHub Desktop.
Save hamoid/a094f8b6b7788e0672e2 to your computer and use it in GitHub Desktop.
(
SynthDef(\lemonade_dream, {
arg gate = 1,
freq = 440,
f2 = 500,
spreadf = 222,
sustain = 1,
amp = 0.1,
mix = 0.1,
release = 0.1;
var sig, sig1, sig2, sig3;
sig1 = (LFPar.ar(freq, 0, amp) +
VarSaw.ar(SinOsc.kr([8,7], 0, 2, [freq*1.01, freq*1.02]), 0, 0, amp));
sig2 = Formant.ar([freq, freq*1.025], f2, spreadf, amp);
sig3 = SinOsc.ar([freq*0.5, freq*0.503], 0, amp*0.5);
sig = Mix.new([mix * sig1, (1-mix) * sig2, sig3]) *
EnvGen.kr(Env.linen(0.01, sustain, release), doneAction: 2);
Out.ar(0, sig);
}).add;
)
c = { arg a, b; a+b; } // the next line means the same
c = { |a, b| a+b; }
c.value(4, 7);
c.value(22, 44);
d = { |item| 1+sin(item)/20 };
d.value(22);
1+sin(22)/20
1+sin(1.5pi+0.4)/20
(
f = { rrand(50, 100) };
p = Pbind(
\amp, Pcollect({ |item| 1+sin(item)/20 }, Pseries(1.5pi, 0.0016, inf)).asStream,
\instrument, \lemonade_dream,
\midinote, Pseq([
Prand([57, 60, 62, 65, 67, 69, 72], f),
Prand([57, 60, 62, 65, 67, 69], f),
Prand([57, 60, 62, 65, 67], f),
Prand([57, 60, 62, 65], f),
Prand([57, 60, 62], f),
Prand([57, 60, 62, 65], f),
Prand([57, 60, 62, 65, 67], f),
Prand([57, 60, 62, 65, 67, 69], f),
], inf),
\f2, Prand([50, 80, 110, 120, 444], inf),
\dur, Pseq([0.01, 0.1], inf),
\spreadf, Pgbrown(111, 666, 0.1, inf),
\mix, Pcollect({ |item| 1+sin(item)/2 }, Pseries(1.5pi, 0.0016, inf)).asStream,
\release, Prand([0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.2, 0.5], inf)
).play;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment