Skip to content

Instantly share code, notes, and snippets.

@reprimande
Created July 31, 2024 11:51
Show Gist options
  • Select an option

  • Save reprimande/84c1ffc4658ef40263d75e25805e77bc to your computer and use it in GitHub Desktop.

Select an option

Save reprimande/84c1ffc4658ef40263d75e25805e77bc to your computer and use it in GitHub Desktop.
(
SynthDef(\fm1, {
var snd, freq;
freq = \freq.kr(440);
snd = PMOsc.ar(freq, freq * \ratio.kr(5.0), \index.kr(10.0) * Env.perc(0.001, \decay.kr(0.5)).ar(Done.none, \gate.kr(1)));
snd = snd * Env.asr(\attack.kr(0.1), 1.0, \release.kr(0.5)).ar(Done.freeSelf, \gate.kr(1));
Out.ar(\out.kr(0), Pan2.ar(snd, \pan.kr(0)) * \amp.kr(1));
}).add;
Pdef(\happybirthday, {
Pbind(
\instrument, \fm1,
\freq, Pseq(([0,0,2,2,0,5,5,4, 0,0,2,2,0,7,7,5, 0,0,12,12,9,5,5,4,4,2, 12,12,9,9,5,7,7,5] + 60).midicps, 1),
\dur, Pseq([2,1,2,1,3,2,1,6, 2,1,2,1,3,2,1,6, 2,1,2,1,3,2,1,2,1,12, 3,1.5,3,1.5,6,4,3,12] * 1/6, 1),
\attack, 0.001,
\decay, 0.8,
\release, 0.5,
\amp, 0.8,
);
}).play;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment