Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save caseyanderson/311c5bb5fc981ab1ec5cdadf9ffefd06 to your computer and use it in GitHub Desktop.

Select an option

Save caseyanderson/311c5bb5fc981ab1ec5cdadf9ffefd06 to your computer and use it in GitHub Desktop.
s.boot;
(
// ==================== SETUP ====================
~monologue = Buffer.read(s,
"C:/Users/cta/Documents/REAPER Media/eisPenumbraSoundDraftsMW04152026/peterlinNoInputV1+TEST.wav",
action: { ">>> monologue loaded".postln; }
);
// REPEAT
~makeRepeatsFunc = { |voiceKey, minRepeats = 1, maxRepeats = 5, asInteger = true, labelOverride = nil|
var voice = ~voices[voiceKey];
var knobIndex = voice.repeatBus;
var label = labelOverride ?? voiceKey.asString.toUpper;
{
var val = (~twisterBusses[knobIndex].getSynchronous ?? 0.0);
var reps = val.linlin(0.0, 1.0, minRepeats, maxRepeats);
if (asInteger) {
reps = reps.asInteger.max(minRepeats.asInteger);
};
postf("→ %: % repeats (knob % = %)\n", label, reps, knobIndex, val.round(0.001));
reps
}
};
)
(
// ==================== SYNTHDEFs ====================
SynthDef(\bufSlice, { |ampControl=0, out=0, bufnum=0, start=0, len=0.3|
var sig, env, amp, phasor;
amp = In.kr(ampControl, 1);
phasor = Phasor.ar(1, BufRateScale.kr(bufnum), start,
start + (len * BufSampleRate.kr(bufnum)), start);
sig = BufRd.ar(1, bufnum, phasor, 0, 4);
env = EnvGen.kr(
Env.new([0,1,1,0], [0.005, len*0.1, len*0.75, 0.035]),
doneAction:2
);
sig = sig * amp * env;
Out.ar(out, sig);
}).add;
SynthDef(\sineTest, { |ampControl=0, out=0, dur=0.2, freq=440|
var sig, env, amp;
amp = In.kr(ampControl, 1);
env = EnvGen.kr(
Env.new([0,1,1,0], [0.005, dur*0.1, dur*0.75, 0.035]),
doneAction:2
);
sig = SinOsc.ar(freq) * amp * env;
Out.ar(out, sig);
}).add;
);
/////////
// ==================== VOICES (OVERLAP) ====================
(
~voices = Dictionary.new; // its possible this has to be outside the block I can't remember
~voices[\slice] = (
synth: \bufSlice,
ampBus: 0,
durBus: 4,
repeatBus: 8,
makePbind: {
Pbind(
\instrument, \bufSlice,
\ampControl, ~twisterBusses[0],
\maxLenBus, ~twisterBusses[4],
\len, Pfunc({ |ev|
var dur = rrand(0.12, 0.6 + ((ev[\maxLenBus].getSynchronous ?? 0.5) * 4.0));
postf("→ slice | base = %s\n", dur.round(0.003));
dur
}),
\start, Pfunc({ |ev|
var len = ev[\len];
var safe = ~monologue.numFrames - (len * ~monologue.sampleRate * 1.15);
rrand(0, safe.asInteger.max(0));
}),
\dur, Pkey(\len),
\delta, Pfunc({ |ev|
var base = ev[\len];
var delta = base * rrand(0.62, 0.78);
postf(" → SLICE delta = %s (overlap ≈ %s%%)\n",
delta.round(0.003), ((1 - (delta/base)) * 100).round(1));
delta
}),
\bufnum, ~monologue
)
}
);
~voices[\sine] = (
synth: \sineTest,
ampBus: 1,
durBus: 5,
repeatBus: 9,
makePbind: {
Pbind(
\instrument, \sineTest,
\ampControl, ~twisterBusses[1],
\dur, Pfunc({ |ev|
var dur = rrand(0.2, 0.8 + ((~twisterBusses[5].getSynchronous ?? 0.5) * 4.0));
postf(" → sine | base = %s\n", dur.round(0.003));
dur
}),
\freq, Pwhite(120, 1400),
\delta, Pfunc({ |ev|
var base = ev[\dur];
var delta = base * rrand(0.62, 0.78);
postf(" → SINE delta = %s (overlap ≈ %s%%)\n",
delta.round(0.003), ((1 - (delta/base)) * 100).round(1));
delta
})
)
}
);
)
// ==================== VOICES (SEPARATED) ====================
~voices = Dictionary.new;
(
~voices[\slice] = (
synth: \bufSlice,
ampBus: 0,
durBus: 4,
repeatBus: 8,
makePbind: {
Pbind(
\instrument, \bufSlice,
\ampControl, ~twisterBusses[0],
\maxLenBus, ~twisterBusses[4],
\len, Pfunc({ |ev|
var dur = rrand(0.12, 0.6 + ((ev[\maxLenBus].getSynchronous ?? 0.5) * 4.0));
postf("→ slice | base = %s\n", dur.round(0.003));
dur
}),
\start, Pfunc({ |ev|
var len = ev[\len];
var safe = ~monologue.numFrames - (len * ~monologue.sampleRate * 1.15);
rrand(0, safe.asInteger.max(0));
}),
\dur, Pkey(\len),
\delta, Pfunc({ |ev| ev[\len] * rrand(0.96, 1.04) }), // very light jitter, almost no overlap
\bufnum, ~monologue
)
}
);
~voices[\sine] = (
synth: \sineTest,
ampBus: 1,
durBus: 5,
repeatBus: 9,
makePbind: {
Pbind(
\instrument, \sineTest,
\ampControl, ~twisterBusses[1],
\dur, Pfunc({ |ev|
var dur = rrand(0.2, 0.8 + ((~twisterBusses[5].getSynchronous ?? 0.5) * 4.0));
postf(" → sine | base = %s\n", dur.round(0.003));
dur
}),
\freq, Pwhite(120, 1400),
\delta, Pfunc({ |ev| ev[\dur] * rrand(0.96, 1.04) }) // very light jitter, almost no overlap
)
}
);
)
// ==================== GESTURES ====================
(
Pdef(\gesture, Pseq([
Pfin(
~makeRepeatsFunc.(\slice),
~voices[\slice].makePbind.value
),
Pfin(
~makeRepeatsFunc.(\sine),
~voices[\sine].makePbind.value
)
], inf));
)
// ==================== GO / STOP ====================
Pdef(\gesture).play;
Pdef(\gesture).stop;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment