musikinformatik / SuperDirt

Tidal Audio Engine
GNU General Public License v2.0
520 stars 74 forks source link

SuperDirt start fails when number of channels > 32 #156

Open dktr0 opened 4 years ago

dktr0 commented 4 years ago

The most information part of the error message seems to be this:

ERROR: makeSynthMsgWithTags: buffer overflow ERROR: Primitive '_NetAddr_SendMsg' failed.

telephon commented 4 years ago

We'll have to dig a bit for this. Do you get the message repeatedly when you hit cmd-period in sclang?

yaxu commented 4 years ago

I got 48 channels to work for me under linux with the following settings. Basically I increased everything by a factor of four without checking which ones helped.. I had to add 'numAudioBusChannels` on top of what is in the example startup that's bundled with superdirt.

s.options.numBuffers = 1024 * 256 * 4; // increase this if you need to load more samples
s.options.memSize = 8192 * 32 * 4; // increase this if you get "alloc failed" messages
s.options.maxNodes = 1024 * 32 * 4; // increase this if you are getting drop outs and the message "too many nodes"
s.options.numAudioBusChannels = 1024 * 4;

I haven't got a 48 channel soundsystem to hand but verified that it's working using supercollider's scope and sound "bd*48" # pan saw.

So I think this is probably a local problem @dktr0.

yaxu commented 4 years ago

I still get this sort of warning:

WARNING: SynthDef dirt_monitor48 too big for sending. Retrying via synthdef file

The errors I was getting before I changed the settings were around 20 repetitions of this:

ERROR: Meta_Bus:audio: failed to get an audio bus allocated. numChannels: 48 server: localhost

Followed by a continuous stream of this:

JackDriver: exception in real time: alloc failed, increase server's memory allocation (e.g. via ServerOptions)
yaxu commented 4 years ago

It looks like my 'too big for sending' warning is related to your makeSynthMsgWithTags error, @dktr0.

telephon commented 4 years ago

I still get this sort of warning:

WARNING: SynthDef dirt_monitor48 too big for sending. Retrying via synthdef file

That's normal. Irritating perhaps (I vaguely remember we thought about switching it off), but harmless as long as you are using an scsynth that is on the same machine as your sclang.

It looks like my 'too big for sending' warning is related to your makeSynthMsgWithTags error, @dktr0.

I don't understand why...

yaxu commented 4 years ago

@telephon I naively thought makeSynthMsgWithTags might be related to sending synthdefs. I'm just on a high after learning how to make a function in sclang though :)

dktr0 commented 4 years ago

@telephon re the error message in my first post above: no I just get it once when launching SuperDirt. Sort of wonder if different OSes and SuperCollider versions will make a difference. Will try soon.

telephon commented 4 years ago

Another step: In the folder SuperDirt/synths, remove all files, just keep core-synths-global.scd. Then do another startup, let's see if the error comes from SynthDef sending as alex suspected.

telephon commented 4 years ago

@dktr0 could you check over here if you can reproduce the behavior? Thanks!

dktr0 commented 4 years ago
(
s.options.numOutputBusChannels = 64;
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
s.options.memSize = 16384 * 32; // increase this if you get "alloc failed" messages
s.options.maxNodes = 2048 * 32; // increase this if you are getting drop outs and the message "too many nodes"
s.waitForBoot {
    ~dirt = SuperDirt(s.options.numOutputBusChannels, s); // <== > 32
    ~dirt.start(57120, 0 ! 12);   // start listening on port 57120, create two busses each sending audio to channel 0
};
);

(edited by telephon, adding three ticks keeps formatting)

When I use the code above (note the change to change the number of output bus channels as well, as well as the further memory increase to avoid alloc failed messages) with 33 channels the error message is (many of):

ERROR: Meta_Bus:audio: failed to get an audio bus allocated. numChannels: 33 server: localhost

When I use the code above with 64 channels, the error is (one of):

ERROR: makeSynthMsgWithTags: buffer overflow ERROR: Primitive '_NetAddr_SendMsg' failed.

telephon commented 4 years ago

yes, I can reproduce this (on macOS), just that with 64 I get:

Exception in World_New: alloc failed, increase server's memory allocation (e.g. via ServerOptions)
Server 'localhost' exited with exit code 0.
telephon commented 4 years ago

This setting works for me:

(
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
s.options.memSize = 8192 * 128; // increase this if you get "alloc failed" messages
s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
s.options.numAudioBusChannels = 1024 * 1024;
s.options.numControlBusChannels = 16384 * 32;

s.waitForBoot {
    ~dirt = SuperDirt(32, s); // <== > 32
    ~dirt.start(57120, 0 ! 12);   // start listening on port 57120, create two busses each sending audio to channel 0
};
);
telephon commented 4 years ago

… and then increasing to 33 needs a bit more memory:

(
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
s.options.memSize = 8192 * 256; // increase this if you get "alloc failed" messages
s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
s.options.numAudioBusChannels = 1024 * 1024;
s.options.numControlBusChannels = 16384 * 32;

s.waitForBoot {
    ~dirt = SuperDirt(33, s); // <== > 32
    ~dirt.start(57120, 0 ! 12);   // start listening on port 57120, create two busses each sending audio to channel 0
};
);
dktr0 commented 4 years ago

I can make that work with 33 but not with 64...

telephon commented 4 years ago

If I try 64, I get:

exception in GraphDef_Load: exceeded number of interconnect buffers.
while reading file: '/Users/wanninger/Library/Application Support/SuperCollider/synthdefs/spectral-delay64.scsyndef'exception in GraphDef_Load: exceeded number of interconnect buffers.

Which requires to increase the numWireBufs (this is per SynthDef: the UGen graphs are getting very large).

(
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
s.options.memSize = 8192 * 256; // increase this if you get "alloc failed" messages
s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
s.options.numAudioBusChannels = 1024 * 1024;
s.options.numControlBusChannels = 16384 * 32;
s.options.numWireBufs = 64 * 64;

s.waitForBoot {
    ~dirt = SuperDirt(64, s);
    ~dirt.start(57120, 0 ! 12);   // start listening on port 57120, create two busses each sending audio to channel 0
};
);

this works for me.

dktr0 commented 4 years ago

I still get the same result with that: ERROR: makeSynthMsgWithTags: buffer overflow ERROR: Primitive '_NetAddr_SendMsg' failed.

telephon commented 4 years ago

@yaxu can you try the above how works for you? Maybe we can narrow it down a little more that way.