Created
February 2, 2025 16:02
-
-
Save dzoba/06404c37f821e740363e5b4c8ebf8bda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // FM Bell Synth – An FM-based bell tone with a delicate shimmer. | |
| SynthDef(\fmBell, { |out=0, freq=440, amp=0.3, pan=0, modIndex=2, carrierRatio=1, modRatio=2, attack=0.01, release=3| | |
| var env = EnvGen.kr(Env.perc(attack, release), doneAction:2); | |
| var modulator = SinOsc.ar(freq * modRatio, 0, freq * modIndex); | |
| var carrier = SinOsc.ar(freq * carrierRatio + modulator, 0); | |
| carrier = FreeVerb.ar(carrier, mix:0.2, room:0.6, damp:0.4); | |
| Out.ar(out, Pan2.ar(carrier * env * amp, pan)); | |
| }).add; | |
| // Ambient Chime Synth Definition (ensure this is loaded) | |
| SynthDef(\chimeSynth, { |out=0, freq=440, amp=0.3, pan=0, decay=4, modRate=0.1, modDepth=0.5| | |
| var env = EnvGen.kr(Env.perc(0.01, decay, 1, -4), doneAction: 2); | |
| var part1 = SinOsc.ar(freq, 0, 0.6); | |
| var part2 = SinOsc.ar(freq * 1.2, 0, 0.4); | |
| var part3 = SinOsc.ar(freq * 1.7, 0, 0.3); | |
| var sound = Mix.new([part1, part2, part3]); | |
| var panPos = SinOsc.kr(modRate, 0, modDepth, pan); | |
| sound = FreeVerb.ar(sound, mix: 0.3, room: 0.7, damp: 0.5); | |
| Out.ar(out, Pan2.ar(sound * env * amp, panPos)); | |
| }).add; | |
| ) | |
| // Crystal Bell: An FM-based bell with a brighter, crystalline edge. | |
| // Uses a highpass filter and a bit more modulation to emphasize brightness. | |
| SynthDef(\crystalBell, { |out=0, freq=440, amp=0.3, pan=0, modIndex=3, carrierRatio=1, modRatio=3, attack=0.01, release=4| | |
| var env = EnvGen.kr(Env.perc(attack, release), doneAction:2); | |
| var modulator = SinOsc.ar(freq * modRatio, 0, freq * modIndex); | |
| var carrier = SinOsc.ar(freq * carrierRatio + modulator, 0); | |
| carrier = HPF.ar(carrier, 500) * 1.5; // Emphasize brightness by filtering out low frequencies. | |
| carrier = FreeVerb.ar(carrier, mix:0.3, room:0.8, damp:0.4); | |
| Out.ar(out, Pan2.ar(carrier * env * amp, pan)); | |
| }).add; | |
| // Mellow Bell: An additive-style bell sound using harmonically related partials. | |
| // This produces a gentle, warm tone with clear harmonic structure. | |
| SynthDef(\mellowBell, { |out=0, freq=440, amp=0.3, pan=0, decay=3| | |
| var env = EnvGen.kr(Env.perc(0.005, decay), doneAction:2); | |
| var partials = Mix.ar([ | |
| SinOsc.ar(freq, 0, 0.4), | |
| SinOsc.ar(freq * 2, 0, 0.3), | |
| SinOsc.ar(freq * 3, 0, 0.2), | |
| SinOsc.ar(freq * 4, 0, 0.1) | |
| ]); | |
| partials = LPF.ar(partials, freq * 3); // Smooth out the high end. | |
| partials = FreeVerb.ar(partials, mix:0.3, room:0.7, damp:0.5); | |
| Out.ar(out, Pan2.ar(partials * env * amp, pan)); | |
| }).add; | |
| ( | |
| // Algorithmic Melody Pattern using \fmBell, \chimeSynth, \crystalBell, and \mellowBell | |
| // This pattern cycles deterministically through the chosen melodic synths and a sequence of scale degrees. | |
| Pdef(\melodyPattern, | |
| Pbind( | |
| \instrument, Pseq([\fmBell, \chimeSynth, \crystalBell, \mellowBell], inf), | |
| \freq, Pseq([ | |
| Scale.major.degreeToFreq(0, 60, 0), | |
| Scale.major.degreeToFreq(2, 60, 0), | |
| Scale.major.degreeToFreq(4, 60, 0), | |
| Scale.major.degreeToFreq(5, 60, 0), | |
| Scale.major.degreeToFreq(7, 60, 0), | |
| Scale.major.degreeToFreq(9, 60, 0) | |
| ], inf), | |
| \amp, Pseq([0.3, 0.35, 0.3, 0.35, 0.3, 0.35], inf), | |
| \atk, 0.01, | |
| \release, 0.5, | |
| \pan, Pseq([-0.5, 0.5, 0, -0.5, 0.5, 0], inf), | |
| \dur, Pseq([0.5, 0.25, 0.75, 0.5, 1, 0.5], inf) | |
| ) | |
| ).play; | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment