// 1. Define SynthDefs for the piece
SynthDef(\baseOsc, { |freq = 440, amp = 0.5, gate = 1|
var env = EnvGen.ar(Env.asr(0.01, 1, 0.3), gate, doneAction: 2);
var sig = SinOsc.ar(freq) * env * amp;
Out.ar(0, sig ! 2);
}).writeDefFile;
SynthDef(\detunedOsc, { |freq = 440, detune = 0, amp = 0.5, gate = 1|
var env = EnvGen.ar(Env.asr(0.01, 1, 0.3), gate, doneAction: 2);
var sig = SinOsc.ar(freq + detune) * env * amp;
Out.ar(0, sig ! 2);
}).writeDefFile;
SynthDef(\granular, { |freq = 440, amp = 0.5, gate = 1|
var env = EnvGen.ar(Env.asr(0.01, 1, 0.3), gate, doneAction: 2);
var sig = GrainBuf.ar(2, BufRD("path/to/buffer"), BufRateScale.kr(BufRateScale.kr(BufRD("path/to/buffer").rate, 1), 1), 0.1, 0.1, 1, 0, BufRateScale.kr(BufRD("path/to/buffer").rate, 1) * 0.5) * env * amp;
Out.ar(0, sig ! 2);
}).writeDefFile;
// 2. Build Score with ONLY explicit [time, message] pairs
Score([
// Base Oscillator Layer
[0.0, [\s_new, \baseOsc, 1001, 0, 0, \freq, 261.63, \amp, 0.3]],
[2.0, [\s_new, \baseOsc, 1002, 0, 0, \freq, 329.63, \amp, 0.3]],
[4.0, [\s_new, \baseOsc, 1003, 0, 0, \freq, 392.00, \amp, 0.3]],
// Detuned Oscillator Layer
[1.0, [\s_new, \detunedOsc, 1004, 0, 0, \freq, 261.63, \detune, 5, \amp, 0.2]],
[3.0, [\s_new, \detunedOsc, 1005, 0, 0, \freq, 329.63, \detune, -5, \amp, 0.2]],
[5.0, [\s_new, \detunedOsc, 1006, 0, 0, \freq, 392.00, \detune, 10, \amp, 0.2]],
// Granular Layer
[6.0, [\s_new, \granular, 1007, 0, 0, \freq, 261.63, \amp, 0.2]],
[8.0, [\s_new, \granular, 1008, 0, 0, \freq, 329.63, \amp, 0.2]],
[10.0, [\s_new, \granular, 1009, 0, 0, \freq, 392.00, \amp, 0.2]],
// Filtering and Modulation
[12.0, [\n_set, 1001, \freq, 293.66]],
[14.0, [\n_set, 1002, \freq, 349.23]],
[16.0, [\n_set, 1003, \freq, 440.00]],
// Note-offs
[20.0, [\n_set, 1001, \gate, 0]],
[20.5, [\n_set, 1002, \gate, 0]],
[21.0, [\n_set, 1003, \gate, 0]],
[21.5, [\n_set, 1004, \gate, 0]],
[22.0, [\n_set, 1005, \gate, 0]],
[22.5, [\n_set, 1006, \gate, 0]],
[23.0, [\n_set, 1007, \gate, 0]],
[23.5, [\n_set, 1008, \gate, 0]],
[24.0, [\n_set, 1009, \gate, 0]],
// End of Score
[120.0, [\c_set, 0, 0]]
]).recordNRT(
outputFilePath: "~/output.wav".standardizePath,
headerFormat: "WAV",
sampleFormat: "int16",
sampleRate: 44100,
options: ServerOptions.new.numOutputBusChannels_(2),
duration: 120,
action: { 0.exit }
);
Toward layered synthesis with detuned oscillators and granular techniques
For using filtering to control the boundary between "dense" and "muddy"
Toward incorporating rhythmic pulse from non-rhythmic sources
Experimenting with granular synthesis techniques
From initial idea to implementation with GrainBuf
The effectiveness of the granular layer in creating rhythmic pulse
The balance between density and clarity in the final mix
To explore more complex modulation techniques in the next session