// 1. Define SynthDef with a combination of oscillators and filters
SynthDef(\complexSynth, { |freq = 440, amp = 0.5, dur = 1, cutoff = 1000, resonance = 0.5|
var env = EnvGen.ar(Env.perc(0.01, dur), doneAction: 2);
var sig1 = SinOsc.ar(freq) * env * amp;
var sig2 = Saw.ar(freq * 1.01) * env * amp * 0.5;
var sig3 = LFNoise0.ar(5) * env * amp * 0.3;
var sig = Mix([sig1, sig2, sig3]);
var filtered = MoogFF.ar(sig, cutoff, resonance);
Out.ar(0, filtered ! 2);
}).store;
// 2. Create a complex pattern with multiple layers
p = Pbind(
\instrument, \complexSynth,
\dur, Pseq([0.25, 0.5, 0.75, 1], inf),
\degree, Pseq([0, 2, 4, 7, 9, 12], inf),
\amp, 0.6,
\cutoff, Pwhite(500, 2000),
\resonance, Pwhite(0.1, 0.9)
);
// 3. Render via NRT
p.asScore(16).recordNRT(
outputFilePath: "~/output.wav".standardizePath,
headerFormat: "WAV",
sampleFormat: "int16",
sampleRate: 44100,
duration: 16
);