s.boot

// A SynthDef without samples, using oscillators and generative modulation
(
SynthDef(\fellGenerative, { |out = 0, amp = 0.3, dur = 1, freq = 440|
    var sig, env, osc1, osc2, noise, mod, freqMod, pan;

    // Base oscillators
    osc1 = SinOsc.ar(freq, 0, 0.5); // Sine wave oscillator 1
    osc2 = Saw.ar(freq * 2, 0.3);   // Saw wave oscillator 2

    // Generate white noise
    noise = WhiteNoise.ar(0.1);

    // Frequency modulation with LFNoise1
    freqMod = LFNoise1.kr(0.1).range(0.9, 1.1);
    osc1 = osc1 * freqMod; // Modulate osc1's frequency slightly over time

    // Envelope for smooth start and end of each sound
    env = EnvGen.kr(Env.perc(0.01, dur), doneAction: 2);

    // Pan modulation
    pan = LFNoise1.kr(0.2).range(-1, 1); // Slow panning for stereo movement

    // Combine the oscillators and noise into a timbre
    sig = osc1 + osc2 + noise;
    sig = sig * env * amp; // Apply amplitude envelope

    // Output the sound with pan control
    Out.ar(out, Pan2.ar(sig, pan));
}).add;
)

// Generate a complex evolving pattern with rhythmic cycles and modulation
(
Pbind(
    \instrument, \fellGenerative,
    \amp, Pwhite(0.2, 0.6, inf),   // Random amplitude
    \freq, Pwhite(100, 1000, inf), // Random base frequencies
    \dur, Pseq([0.3, 0.5, 1, 0.7], inf), // Rhythmic durations
    \mod, Pwhite(0.2, 1.5, inf)    // Random modulation depth for oscillators
).play;
)
