Hi can anyone tell me what’s wrong with my SuperCollider engine that would cause Norns to throw a SUPERCOLLIDER ERROR at every boot?
// CroneEngine_GridKit
// Simple synth drum kit
// Drum algorithms from
// https://sccode.org/1-523
Engine_GridKit : CroneEngine {
// Trigger kick voice. Value of trigger maps to voice amp
var trig_kick = 0.3;
// Trigger snare voice. Value of trigger maps to voice amp
var trig_snare = 0.3;
// Trigger hat voice. Value of trigger maps to voice amp
var trig_hat = 0.3;
*new { arg context, doneCallback;
^super.new(context, doneCallback);
}
alloc {
pg = ParGroup.tail(context.xg);
SynthDef("kick", {
|out = 0, pan = 0, amp = 0.3|
var body, bodyFreq, bodyAmp;
var pop, popFreq, popAmp;
var click, clickAmp;
var snd;
// Body starts midrange, quickly drops down to low freqs, and trails off
bodyFreq = EnvGen.ar(Env([261, 120, 51], [0.035, 0.08], curve: \exp));
bodyAmp = EnvGen.ar(Env.linen(0.005, 0.1, 0.3), doneAction: 2);
body = SinOsc.ar(bodyFreq) * bodyAmp;
// Pop sweeps over the midrange
popFreq = XLine.kr(750, 261, 0.02);
popAmp = EnvGen.ar(Env.linen(0.001, 0.02, 0.001)) * 0.15;
pop = SinOsc.ar(popFreq) * popAmp;
// Click is spectrally rich, covering the high-freq range
// You can use Formant, FM, noise, whatever
clickAmp = EnvGen.ar(Env.perc(0.001, 0.01)) * 0.15;
click = LPF.ar(Formant.ar(910, 4760, 2110), 3140) * clickAmp;
snd = body + pop + click;
snd = snd.tanh;
Out.ar(out, Pan2.ar(snd, pan, amp));
}).add;
SynthDef("snare", {
|out = 0, pan = 0, amp = 0.3|
var pop, popAmp, popFreq;
var noise, noiseAmp;
var snd;
// Pop makes a click coming from very high frequencies
// Slowing down a little and stopping in mid-to-low
popFreq = EnvGen.ar(Env([3261, 410, 160], [0.005, 0.01], curve: \exp));
popAmp = EnvGen.ar(Env.perc(0.001, 0.11)) * 0.7;
pop = SinOsc.ar(popFreq) * popAmp;
// bandpass-filtered white noise
noiseAmp = EnvGen.ar(Env.perc(0.001, 0.15), doneAction: 2);
noise = BPF.ar(WhiteNoise.ar, 810, 1.6) * noiseAmp;
snd = (pop + noise) * 1.3;
Out.ar(out, Pan2.ar(snd, pan, amp));
}).add;
SynthDef("hat", {
|out = 0, pan = 0, amp = 0.3|
var click, clickAmp;
var noise, noiseAmp;
var snd;
// Noise -> resonance -> expodec envelope
noiseAmp = EnvGen.ar(Env.perc(0.001, 0.3, curve: -8), doneAction: 2);
noise = Mix(BPF.ar(ClipNoise.ar, [4010, 4151], [0.15, 0.56], [1.0, 0.6])) * 0.7 * noiseAmp;
snd = noise;
Out.ar(out, Pan2.ar(snd, pan, amp));
}).add;
this.addCommand("trig_kick", "f", { arg msg;
trig_kick = msg[1];
Synth("kick", [\out, context.out_b, \amp, trig_kick], target:pg);
});
this.addCommand("trig_snare", "f", { arg msg;
trig_snare = msg[1];
Synth("snare", [\out, context.out_b, \amp, trig_snare], target:pg);
});
this.addCommand("trig_hat", "f", { arg msg;
trig_hat = msg[1];
Synth("hat", [\out, context.out_b, \amp, trig_hat], target:pg);
});
}
}
The engine is based on the simplest engine I could find in Dust, the PolyPerc engine used by the Awake script, and is my first attempt at writing an engine so I’m sure it’s something stupid.