// 1. Define SynthDefs and write to disk
SynthDef(\kick, { |amp = 0.8, gate = 1|
var env = EnvGen.ar(Env.asr(0.01, 1, 0.3), gate, doneAction: 2);
var sig = SinOsc.ar(50, 0, 0.1) * env * amp;
Out.ar(0, sig ! 2);
}).writeDefFile;
SynthDef(\snare, { |amp = 0.6, gate = 1|
var env = EnvGen.ar(Env.asr(0.01, 0.5, 0.2), gate, doneAction: 2);
var sig = WhiteNoise.ar * env * amp;
sig = LPF.ar(sig, 5000);
Out.ar(0, sig ! 2);
}).writeDefFile;
SynthDef(\bass, { |freq = 60, amp = 0.7, gate = 1|
var env = EnvGen.ar(Env.asr(0.01, 1, 0.3), gate, doneAction: 2);
var sig = SinOsc.ar(freq) * env * amp;
sig = LPF.ar(sig, 100);
Out.ar(0, sig ! 2);
}).writeDefFile;
// 2. Build Score with ONLY explicit [time, message] pairs
Score([
// Kick and snare pattern
[0.0, [\s_new, \kick, 1001, 0, 0, \amp, 0.8]],
[0.5, [\s_new, \snare, 1002, 0, 0, \amp, 0.6]],
[1.0, [\s_new, \kick, 1003, 0, 0, \amp, 0.8]],
[1.5, [\s_new, \snare, 1004, 0, 0, \amp, 0.6]],
[2.0, [\s_new, \kick, 1005, 0, 0, \amp, 0.8]],
[2.5, [\s_new, \snare, 1006, 0, 0, \amp, 0.6]],
[3.0, [\s_new, \kick, 1007, 0, 0, \amp, 0.8]],
[3.5, [\s_new, \snare, 1008, 0, 0, \amp, 0.6]],
// Bassline pattern
[0.0, [\s_new, \bass, 1009, 0, 0, \freq, 60, \amp, 0.7]],
[2.0, [\s_new, \bass, 1010, 0, 0, \freq, 63, \amp, 0.7]],
[4.0, [\s_new, \bass, 1011, 0, 0, \freq, 65, \amp, 0.7]],
[6.0, [\s_new, \bass, 1012, 0, 0, \freq, 63, \amp, 0.7]],
// Note-offs
[3.5, [\n_set, 1001, \gate, 0]],
[3.5, [\n_set, 1002, \gate, 0]],
[5.5, [\n_set, 1003, \gate, 0]],
[5.5, [\n_set, 1004, \gate, 0]],
[7.5, [\n_set, 1005, \gate, 0]],
[7.5, [\n_set, 1006, \gate, 0]],
[9.5, [\n_set, 1007, \gate, 0]],
[9.5, [\n_set, 1008, \gate, 0]],
[10.0, [\n_set, 1009, \gate, 0]],
[12.0, [\n_set, 1010, \gate, 0]],
[14.0, [\n_set, 1011, \gate, 0]],
[16.0, [\n_set, 1012, \gate, 0]],
// End of the 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 rhythmic pulse and textural density
for combining sampled percussion with synthesized bass
from initial idea to structured implementation
about the exact timing and arrangement of the bassline
toward exploring more complex rhythmic patterns