Skip to content

Instantly share code, notes, and snippets.

@mbutz
Created April 7, 2017 16:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mbutz/dc11a619b8e2f471bb11a3b89b899896 to your computer and use it in GitHub Desktop.
Save mbutz/dc11a619b8e2f471bb11a3b89b899896 to your computer and use it in GitHub Desktop.
Rudimentary Fender Rhodes Synth Definition for Sonic Pi with SuperCollider
// Thanks to snappizz, http://sccode.org/1-522 thanks to hint and help by Alexandre Enkerli
// At least you can specify frequency as a midi note
(
SynthDef(\rhodes, {
|
// standard meanings
out_bus = 0, note = 60, amp = 1, out = 0, gate = 1, pan = 0,
// all of these range from 0 to 1
vel = 0.8, modIndex = 0.2, mix = 0.2, lfoSpeed = 0.4, lfoDepth = 0.1
|
var freq = note.midicps;
var env1, env2, env3, env4;
var osc1, osc2, osc3, osc4, snd;
lfoSpeed = lfoSpeed * 12;
freq = freq * 2;
env1 = EnvGen.ar(Env.adsr(0.001, 1.25, 0.0, 0.04, curve: \lin));
env2 = EnvGen.ar(Env.adsr(0.001, 1.00, 0.0, 0.04, curve: \lin));
env3 = EnvGen.ar(Env.adsr(0.001, 1.50, 0.0, 0.04, curve: \lin));
env4 = EnvGen.ar(Env.adsr(0.001, 1.50, 0.0, 0.04, curve: \lin));
osc4 = SinOsc.ar(freq * 0.5) * 2pi * 2 * 0.535887 * modIndex * env4 * vel;
osc3 = SinOsc.ar(freq, osc4) * env3 * vel;
osc2 = SinOsc.ar(freq * 15) * 2pi * 0.108819 * env2 * vel;
osc1 = SinOsc.ar(freq, osc2) * env1 * vel;
snd = Mix((osc3 * (1 - mix)) + (osc1 * mix));
snd = snd * (SinOsc.ar(lfoSpeed) * lfoDepth + 1);
// using the doneAction: 2 on the other envs can create clicks (bc of the linear curve maybe?)
snd = snd * EnvGen.ar(Env.asr(0, 1, 0.1), gate, doneAction: 2);
snd = Pan2.ar(snd, pan, amp);
Out.ar(out_bus, snd);
}).store;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment