Reading another thread reminded me of a strange ‘situation’ I had in the past, so I dug up the code (below).
I had made two versions of the same code, one ‘normal’, the other using named controls. With the second one, \sk2
, I can run less partials in the DynKlang Ugen before it errors on the number of interconnect buffers. In the startup file there is s.options.numWireBufs = 128;
.
When I manually set numWireBufs again and reboot the server sk2
works better, that is the ~segments
setting can be higher (than 21), but not as high as for \sk1
that can go to the max. Also the maximum setting varies.
Reducing the scene makes the problem go away. (Reduced too much?)
EDIT: Win11 & SC 3.12.2
// s.options.numWireBufs = 128; //set in startup file
(
~shuheiKawachi = {
arg x, y, a, b;
((cos(x) * cos(y))
+ (cos((sqrt(a) * x - y) / b)
* cos((x + (sqrt(a) * y) ) / b))
+ (cos(( sqrt(a) * x + y) /b)
* cos((x - (sqrt(a) * y*y)) / b)))/3;
};
)
(
~segments = 80;
Ndef(\sk1, {
arg xMajor = 0.0
, yMajor = 0.0
, rMajor = 100
, rMinor = 1.5
, circlefreq = 0.0005
, a = 2 * pi
, b = 0.5
;
var arr, result, xMinor, yMinor, freqs, amps, phase;
freqs = Array.exprand(~segments, 50, 1500).sort;
phase = Array.fill(~segments, 0.0);
xMinor = xMajor + (rMajor * SinOsc.ar(circlefreq));
yMinor = yMajor + (rMajor * SinOsc.ar(circlefreq, pi / 2));
amps = Array.fill(
~segments,
{
arg seg;
x = xMinor + (rMinor * sin(seg * 2 * pi / ~segments));
y = yMinor + (rMinor * cos(seg * 2 * pi / ~segments));
result = abs(~shuheiKawachi.(x, y, a, b)) / 12;
result
}
);
d = DynKlang.ar(`[freqs, amps, phase]);
Out.ar(0, d!2)
});
)
(
~segments = 22; // #partials
Ndef(\sk2, {
var rMajor = \rMajor.kr(100.0);
var rMinor = \rMinor.kr(1.5);
var circlefreq = \circlefreq.kr(0.0005);
var result, xMinor, yMinor, freqs, amps, phase;
freqs = Array.exprand(~segments, 50, 1500).sort;
phase = Array.fill(~segments, 0.0);
xMinor = \xMajor.kr(0.0) + (rMajor * SinOsc.ar(circlefreq));
yMinor = \yMajor.kr(0.0) + (rMajor * SinOsc.ar(circlefreq, pi / 2));
amps = Array.fill(
~segments,
{
arg seg;
x = xMinor + (rMinor * sin(seg * 2 * pi / ~segments));
y = yMinor + (rMinor * cos(seg * 2 * pi / ~segments));
result = abs(~shuheiKawachi.(x, y, \a.kr(2 * pi), \b.kr(0.5) )) / 12;
result
}
);
d = DynKlang.ar(`[freqs, amps, phase]);
Out.ar(0, d!2)
});
)
Ndef(\sk1).clear;
Ndef(\sk2).clear;
// exception in GraphDef_Load: exceeded number of interconnect buffers.
// while reading file: '...\synthdefs\temp__0sk2-486857386_1049.scsyndef'exception in GraphDef_Load: exceeded number of interconnect buffers.
// while reading file: '...\synthdefs\temp__0sk2-486857386_1049.scsyndef'*** ERROR: SynthDef temp__0sk2-486857386_1049 not found
// FAILURE IN SERVER /s_new SynthDef not found
Reduced version,
(
~segments = 80;
Ndef(\sk1, {
arg minamp = 0, maxamp = 1;
var arr, result, xMinor, yMinor, freqs, amps, phase;
freqs = Array.exprand(~segments, 50, 1500).sort;
amps = Array.rand(~segments, 0, 1) * 0.05;
phase = Array.fill(~segments, 0.0);
d = DynKlang.ar(`[freqs, amps, phase]);
Out.ar(0, d!2)
});
)
(
~segments = 80;
Ndef(\sk2, {
var arr, result, xMinor, yMinor, freqs, amps, phase;
freqs = Array.exprand(~segments, 50, 1500).sort;
amps = Array.rand(~segments, \minamp.kr(0), \maxamp.kr(1)) * 0.05;
phase = Array.fill(~segments, 0.0);
d = DynKlang.ar(`[freqs, amps, phase]);
Out.ar(0, d!2)
});
)
Ndef(\sk1).clear;
Ndef(\sk2).clear;