Detuned Ambience

supercollider
// 1. Define SynthDef and write to disk
SynthDef(\ambientPad, { |freq1 = 220, freq2 = 221, amp = 0.3, gate = 1|
    var env = EnvGen.ar(Env.linen(0.5, 20, 0.5), gate, doneAction: 2);
    var sig1 = SinOsc.ar(freq1) * env * amp;
    var sig2 = SinOsc.ar(freq2) * env * amp;
    var sig = (sig1 + sig2);
    var reverb = FreeVerb.ar(sig, 0.8, 0.8, 0.8);
    var filtered = LPF.ar(reverb, 2000);
    Out.ar(0, filtered ! 2);
}).writeDefFile;

// 2. Build Score with ONLY explicit [time, message] pairs
Score([
    [0.0, [\s_new, \ambientPad, 1001, 0, 0, \freq1, 220, \freq2, 221, \amp, 0.3]],
    [10.0, [\n_set, 1001, \freq1, 219]],
    [20.0, [\n_set, 1001, \freq2, 222]],
    [30.0, [\n_set, 1001, \freq1, 220]],
    [40.0, [\n_set, 1001, \freq2, 221]],
    [50.0, [\n_set, 1001, \gate, 0]],
    [60.0, [\c_set, 0, 0]]
]).recordNRT(
    outputFilePath: "~/ambient_pad.wav".standardizePath,
    headerFormat: "WAV",
    sampleFormat: "int16",
    sampleRate: 44100,
    options: ServerOptions.new.numOutputBusChannels_(2),
    duration: 60,
    action: { 0.exit }
);
toward textural density layered sine waves long reverb tails toward controlled timbre low-pass filtering from static frequencies to modulated frequencies toward subtle movement how much detuning creates optimal beating toward more complex modulation toward incorporating movement