I am only just starting with SuperCollider and getting stuck understanding how to actually parse various blocks of code in one go. So here’s the scenario (below); I have three SynthDefs, which I can parse/execute in one go (no probs there) - but I can’t figure out how to include the routine that follows (i.e. starting with var g=group) … any advice on how to do this?
SynthDef(
…
}).add;
SynthDef(
…
}).add;
SynthDef(
…
}).add;
var g=Group.basicNew(s,1);
var stereoBuffer1L = Buffer.alloc(s, s.sampleRate*2, 1);
var stereoBuffer1R = Buffer.alloc(s, s.sampleRate*2, 1);
var monoBuffer1 = Buffer.alloc(s, s.sampleRate*2, 1);
var rootPitch=36; // Start on a C
var stopTranspose = 0;
var transposeCount = 10;//Wait a while after transposing to minimise semitone clashes
//Non-ET pentatonic ratios
var thisRatio = [0.25, 0.5, 0.75, 1, 1.125, 1.333333, 1.5, 1.6875, 2, 2.25, 2.6666666, 3, 3.375, 4, 5];
var thisPitch;
var svf = Synth.tail(g, \Filters);
var d = Synth.tail(g, \StereoModDelay);
stereoBuffer1L.zero;
stereoBuffer1R.zero;
d.set(\bufferL, stereoBuffer1L);
d.set(\bufferR, stereoBuffer1R);
thisPitch = thisRatio.choose*rootPitch.midicps;
//First few notes have a slow attack and longer interval
{4.do
{
Synth.head(g, \ChMach,
[\f, thisPitch,
\width, rrand(0,1),
\pan, rrand(-1,1),
\aTime, rrand(5,15),
\rTime, rrand(7,20),
\filter, rrand(4,10),
\filterQ, rrand(0,3.7),
\modFreq, rrand(0.7,1.5)]);
rrand(1,3).wait;
}
};
//Pick a note from the pentatonic scale with somewhat random settings
//and slowly noodle around the circle of fifths
{inf.do
{
thisPitch = thisRatio.choose*rootPitch.midicps;
stopTranspose = stopTranspose + 1;
Synth.head(g, \ChMach,
[\f, thisPitch,
\width, rrand(0,1),
\pan, rrand(-1,1),
\aTime, rrand(0.01,15),
\rTime, rrand(7,20),
\filter, rrand(4,10),
\filterQ, rrand(0,3.7),
\modFreq, rrand(0.7,1.5)]);
if ((0.04.coin) && (stopTranspose > transposeCount)) {
stopTranspose = 0;
rootPitch = rootPitch + 7;
if (rootPitch > 47) {rootPitch = rootPitch - 12};
rootPitch.postln;
};
rrand(0.1,2).wait;
}
}.fork;