SuperCollider plugin that embeds the Cmajor JIT engine for fast, high-performance development of DSP code on a running scsynth / supernova server.
You can download the pre-built binary of the plugin from the Releases.
To build, use the build.bat (Windows) or build.sh (Unix) scripts.
Check the help files of the CmajorDef and Cmajor classes.
(
s.waitForBoot({
var code = "
processor DualOsc
{
input value float freq;
input value float modDepth;
input value float detune;
output stream float<2> out;
void main()
{
float64 a = 0.0;
float64 b = 0.0;
float64 phaseA = 0.0;
float64 phaseB = 0.0;
loop
{
let incA = freq * processor.period * twoPi;
let incB = (freq + detune) * processor.period * twoPi;
phaseA = addPhase(phaseA, incA);
phaseB = addPhase(phaseB, incB);
a = sin(phaseA + (b * modDepth));
b = sin(phaseB + (a * modDepth));
out <- (float(a), float(b));
advance();
}
}
float64 addPhase(float64 p, float64 inc)
{
p += inc;
if (p >= twoPi) p -= twoPi;
return p;
}
}
graph OversampledDualOsc [[ main ]]
{
input value float freq [[ min: 20, max: 2000, init: 110 ]];
input value float modDepth [[ min: 0, max: 10, init: 1.5 ]];
input value float detune [[ min: 0, max: 20, init: 1.0 ]];
output stream float<2> out;
node osc = DualOsc() * 8; // x8 oversampling
connection
{
freq -> osc.freq;
modDepth -> osc.modDepth;
detune -> osc.detune;
osc.out -> out;
}
}
";
CmajorDef(\dualOsc, code).send;
s.sync;
x = {
var freq = MouseX.kr(20, 500, 1);
var depth = MouseY.kr(1, 5);
var detune = LFNoise1.kr(0.5).range(0, 12);
Cmajor.ar(\dualOsc, (freq: freq, modDepth: depth, detune: detune)) * 0.5
}.play;
});
)