Hello,
here some quick tests with three SynthDefs that took 3-4 % average CPU on my Desktop. I find the results very interesting. To sum up: it turned out that average CPU is higher on the laptop, In the end dropouts are reached at pretty the same amount of synths. This is good news as it shows that there’s at least no decline in these examples as one could assume by higher average CPU (and it confirms Scott). A larger hardware buffer size (went from 512 to 4096 with built-in audio) could raise the limit by a third in some examples, so this is really a good option (when not using patterns)!
I got the limits by taking the largest number of synths that didn’t give dropouts by moving the IDE window (rough check indeed). This conincided with avoiding to go above 90 % with peak CPU (which could be difficult to estimate with many LFOs e.g.).
desktop: iMac 3.2 GHz i5, 2013, OSX 10.10
laptop: MacBook 2.2 GHz 6-core i7, 2018, OSX 10.15
I’ve used a Normalizer at the end of the signal chain, but be careful with amplitudes anyway because of dropouts.
// boot with extended ressources
(
s.options.maxNodes = 1024 * 64;
s.options.memSize = 8192 * 16;
s.options.numWireBufs = 64 * 16;
s.reboot;
)
// SynthDefs, n chosen to reach 3-4 % avg CPU
(
SynthDef(\cpu_test_1, { |out, freq = 400, amp = 0.1|
var n = 350;
var sig = SinOsc.ar(freq ! n, 0, amp) / n;
Out.ar(out, Mix(sig) ! 2 * EnvGate())
}).add;
SynthDef(\cpu_test_2, { |out, freq = 400, amp = 0.1|
var n = 100;
var lfo = SinOsc.ar(10).range(10, 50);
var sig = { |i| VarSaw.ar(lfo, 1 / (i + 1)) } ! n;
sig = BPF.ar(sig, freq, 0.01) * amp * 100 / n;
Out.ar(out, Mix(sig) ! 2 * EnvGate())
}).add;
SynthDef(\cpu_test_3, { |out, freq = 400, amp = 0.1|
var n = 80;
var lfo = SinOsc.ar(10).range(10, 50);
var sig = { GrainSin.ar(1, Impulse.ar(lfo), 0.05, freq, mul: amp * 0.2) } ! n / n;
Out.ar(out, Mix(sig) ! 2 * EnvGate())
}).add;
SynthDef(\normalizer, { |inBus, amp = 0.1|
Out.ar(0, Normalizer.ar(In.ar(inBus, 2), amp))
}).add;
~bus = Bus.audio(s, 2);
)
// produces num synths playing all to the normalizer bus
(
~makeCpuTest = { |synthType = 1, num = 10, midi = 60, amp = 0.1|
var instr = \cpu_test_ ++ (synthType.asString), synths, group;
Task {
group = Group();
0.2.wait;
(
instrument: \normalizer,
inBus: ~bus,
amp: amp,
group: group,
addAction: \addAfter
).play;
synths = num.collect {
(
instrument: instr,
dur: inf,
midinote: midi,
amp: amp,
group: group,
out: ~bus
).play
}
}.play;
};
)
// play single synths
~makeCpuTest.(1, 1, 65)
~makeCpuTest.(2, 1, 65)
~makeCpuTest.(3, 1, 65)
// limits on my desktop
~makeCpuTest.(1, 23, 65)
~makeCpuTest.(2, 27, 65)
~makeCpuTest.(3, 18, 65)
// limits on my laptop
~makeCpuTest.(1, 25, 65)
~makeCpuTest.(2, 22, 65)
~makeCpuTest.(3, 18, 65)
// limits on my laptop with higher hardware buffer size
// after reboot
(
s.options.maxNodes = 1024 * 64;
s.options.memSize = 8192 * 16;
s.options.numWireBufs = 64 * 16;
s.options.hardwareBufferSize = 4096;
s.reboot;
)
~makeCpuTest.(1, 27, 65)
~makeCpuTest.(2, 30, 65)
~makeCpuTest.(3, 27, 65)
Greetings
Daniel