( SynthDef(\mellotron, { arg freq = 440, amp = 0.8, gate = 1, pan = 0, vibratoRate = 1, vibratoDepth = 0.15, noiseLevel = 0.2, ringModFreq = 3, lpfFreq = 2000, res = 0.8, lpfLfoRate = 1, lpfLfoDepth = 100, detune = 0.005; var sig, osc1, osc2, vibrato, noise, env, lpfMod, freq1, freq2; vibrato = SinOsc.kr(vibratoRate, 0, vibratoDepth).range(0.98, 1.02); freq1 = (freq * (0.99))/4; freq2 = (freq * (1.01))/2; osc1 = Mix([ LFTri.ar(freq1 * vibrato), LFTri.ar(freq2 * vibrato) ]) * 0.5; noise = WhiteNoise.ar(noiseLevel); osc1 = Mix([osc1, noise * 0.5]); osc2 = Mix([ Saw.ar(freq1 * ringModFreq), SinOscFB.ar(freq2 * ringModFreq) ]) * 0.5 * osc1; sig = Mix([ osc1, osc2 * 0.5]); lpfMod = SinOsc.kr(lpfLfoRate).range(lpfFreq - lpfLfoDepth, lpfFreq + lpfLfoDepth); sig = RLPF.ar(sig, lpfMod, res); env = EnvGen.kr(Env.adsr(0.2, 3, 1, 2), gate, doneAction: 2); sig = sig * env * amp; sig = sig.tanh(8); sig = BLowShelf.ar(sig, 200, 0.5, 9); Out.ar(0, Pan2.ar(sig, pan)); }).add; ) ( Pbind( \instrument, \mellotron, \freq, Pseq([ // [65, 69, 71], // F Major (F, A, C) [80, 75,], [90, 70], [90, 70], [80, 65] ].midicps, inf), // Use MIDI note numbers for frequencies \dur, Pseq([2, 0.5, 0.5, 1],inf), \vibratoRate, 5, // Adding more vibrato (changeable) \vibratoDepth, 0.15, // Keep vibrato depth as is \lpfFreq, 1200, // LPF for smoothing \lpfLfoRate, 0.1, // Slow LFO modulation for LPF \lpfLfoDepth, 100, // Depth of LPF modulation // \detune, -12, // Slight detuning for realism \pan, Pseq([0.5, -0.5], inf), // Panning left and right for stereo spread ).play; )