-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
numAudioBusChannels on Bela scsynth lower than remote sclang #67
Comments
Sorry I did not see this before. I am not sure. In regular supercollider, what is the default number of |
now, in
and these are the same in the Bela fork (soon to be updated and rebased!) and in the upstream SC 3.10 branch. The server comes with its own defaults (
so there seems to be different defaults, some built into the server and some used by the language. However, the language does not apply its internal defaults. It only uses them to check whether the user has edited them, otherwise it omits the command line option (and hence uses the server's default). Either way, the defaults for Therefore
Can you tell me a bit more about how you debugged this and how I can reproduce it? Some step-by-step guide (including code) to reproduce the failure would greatly help. I really don't know how to use Sc! |
Hey @giuliomoro, sorry for the huge delay; I was on vacation when you replied and just moved to a new house a few weeks ago. I sort of forgot about this. Coincidentally I actually booted my Bela last night for the first time in months. I will set aside some time this weekend to reproduce this and see if I can figure out where the issue is coming from. Super excited to hear that SuperCollider fork is going to be updated! |
No worries. In fact I only looked at this again last night as I realized that Sc 3.10 is about to be released and I thought it'd be good to have a painless way of updating and building sc-bela after every upstrean release. Current plan is to squash all our commits so far into a single one. There are only a small number of files being modified, so rebasing these changes on top if any new release should be easy enough. |
Okay, tested again I still get this behavior (although I haven't updated Bela since June, so I should probably do that). Here are my steps:
(that IP was set by my router, which my Bela is plugged into)
In theory, the audio from synth However, I don't hear anything, unless if I start over and add Interestingly, if I try
in that script, I get |
Ok what I notice is that:
If you run that block again, it will sound. My limited understanding of Sc makes me think that it is normal that it fails, because there is not enough time to "create" the synthdef on the server before the instantiation message comes in. However, if I run one bit at a time:
it works fine first time.
in the script that runs on the board, I get Does the same happen to you? |
Hmm, running the block of code in one go actually works fine for me, in the sense that the synths get created with no error message (but I don't get sound). I can also verify that the synths are loaded by looking at But you're definitely right; if the server tries to create a synth before its definition has been loaded, it will fail. Not sure why we're getting a difference there. Whoops, I meant to type
This is printing If it helps, this is what I'm getting for the versions of scsynth/sclang:
|
If the Sc IDE is open, running the wohle block of code multiple times (after restarting the server on Bela) will work fine: only the first time I run the block after starting the SC IDE do I get that error.
I think I tried this as well and I get 1024. I will check again tomorrow.
I think that is exactly the same I have (and I get the same result with 3.10beta, too). I don't think if that makes any difference, but could you try to connect the Bela board directly to your computer (without the router?). Also what version of the Sc IDE are you running ? |
Writing a
Regarding the |
Thanks @nuss, I agree that adding the new synth must wait until the synthdefs are defined, and that is a problem with my example. However, I verified that the synths were actually running and there was no error in the sclang output. The issue I was seeing was in I just had a look at the file you linked and I think I see the problem now. When we call s.boot, it actually builds a string of command line options to pass scsynth. one of which is The
In vanilla SC, numPrivateAudioBusChannels is 1020, numOutputChannels and numInputChannels are both 2. In the Bela fork, numPrivateAudioBusChannels is set to 112. Add the four for numOutputChannels and numInputChannels, and you get the 116 I was talking about. |
It's interesting - diffing the two versions of that file, I see that the implementation of The Bela version has some logic for dividing the number of buses for the allocator by This seems like something that would be useful for a laptop orchestra; it looks like multiple clients can connect, and each gets their own isolated Group and set of Buses to work with. So I'm speculating the numPrivateAudioBusChannels was probably reduced from I think this is cool, but maybe shouldn't be the default. |
The division of private audio buses over maxNumClients is not unique to
Bela. It is just one of the cases where it's use becomes clear. It was
originally meant for exactly that use: more than one client using one
server.
numPrivateAudioBusChannels = 112 is the default amount set in
ServerOptions (look at the class implementation) and will be what is set
for the Bela server (calling Server.new sets a fresh instance of
ServerOptions as options).
The issue is that the server is not explicitly set in Bus.audio().
Looking at the implementation of Bus.audio(), you can see that the
server argument is assigned the default server if it is not given a
value. So instead of allocating a bus from the Bela server, it allocates
a bus from your default server.
*audio { arg server, numChannels=1;
var alloc;
server = server ? Server.default;
alloc = server.audioBusAllocator.alloc(numChannels);
if(alloc.isNil) {
error("Meta_Bus:audio: failed to get an audio bus allocated."
+ "numChannels:" + numChannels + "server:" + server.name);
^nil
};
^this.new(\audio, alloc, numChannels, server)
}
So I don't think this is a Bela specific bug (none of the involved code
was modified for Bela), but a user mistake in the call to Bus.audio.
…On 09/09/18 04:01, Brian Fay wrote:
It's interesting - diffing the two versions of that file, I see that the
implementation of |newBusAllocators| has also changed, which may mean
that this is fine when running the sclang code directly on the Bela.
The Bela version has some logic for dividing the number of buses for the
allocator by |maxNumClients|, which is also a new concept to the Bela
implementation.
This seems like something that would be useful for a laptop orchestra;
it looks like multiple clients can connect, and each gets their own
isolated Group and set of Buses to work with.
So I'm speculating the numPrivateAudioBusChannels was probably reduced
from |1024| to |112| because it would allow multiple users to get their
own buses, without increasing overall memory usage on the server.
I think this is cool, but maybe shouldn't be the default.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMS3rj3ecRExaen-oSGioSXOrn9BzMIks5uZHZqgaJpZM4Ufdph>.
--
Sense/Stage
Webpage: https://www.sensestage.eu
Forum: https://forum.sensestage.eu
Facebook page: https://www.facebook.com/EUSenseStage/
|
I'll test though... |
Ok, looking at the code again, I see that you set the default Server to the bela server, so that should be ok then. Trying to retrace your steps:
First that code is not meant to run on bela, as it states at the top of the file ("run this in SC IDE" - perhaps we need to add something here? 'on your laptop'?).
Then I think it may be good to modify the code in SCIDE a little bit, to ensure there were no issues with overlapping clients:
Then I would be interested in what:
I find myself a bit at a disadvantage right now, as I am still on an older version of SC on my laptop, and with a show coming up next week, I don't want to update to a new build. scsynth running on Bela will have two clients: the sclang running on Bela, and the sclang running on your laptop. Starting scsynt from Bela's commandline with: Using that I can run your example without issues. So perhaps something changes with the new allocators. |
Just a quick note:
When running that program, the |
ah, ok. Also my Bela version was a bit older... Perhaps I should refrain from posting until I actually have time to set up up-to-date systems again and test with the latest version.... |
Thanks @sensestage, I tried running with:
as you suggested. I get the same behavior as earlier. When I call I'm using SuperCollider 3.9 on my laptop, which does have different code in I am still really confused about In the upstream it's initially set to The Bela fork has the older code that still initializes it to Maybe the preferred logic is to have 1020 buses, and split them evenly between the clients? Or maybe it should be to have 112 buses per each client? I'm really not sure. But at least I have the workaround of manually setting the |
That commit fixes the inconsistency between 1024 for numAudioBusChannels and 122 numPrivateAudioBusChannels. I just made a comment that then the default value in the setter should have the same fix. There is some recalculation happening when you set numAudioBusChannels:
and viceversa:
I have a hunch though that the issue might be in line 74 of Server.sc:
and that that should be:
Could you try that? And if this is the fix, then it should be fixed upstream as |
You could check on the Bela after you fix by adding the line:
to your server startup script. |
Hey @sensestage, thanks for the suggestion, I think you're definitely right. If I update
I still get However, if I also no-op the
then I get So I'm still confused about the intent of But it seems like we're also trying to use the term to mean the number of audio buses reserved to each client. Maybe that warrants adding a separate variable, like But I may be missing something, and I guess even if that does need to be changed, it should happen in the upstream branch. |
I definately think something is wrong in the upstream about this, confusing the buses per client and the desired/needed server arguments. |
Given how you seem to have some insights on this, could you create an issue upstream? |
is this still current and/or related to #74 ? |
Hi, I've been struggling to build a simple guitar looper using SuperCollider on Bela.
After a ton of debugging I realized that using sclang's bus allocator (I'm calling
Bus.audio()
) must be creating a bus with an index that's too high for Bela. If I tried providing my own bus index, say around 10, things were fine. But if I usedBus.audio()
, with a bus index in the hundreds, I got silence.Setting this parameter in the server startup with
s.options.numAudioBusChannels = 1024;
fixes the issue.I'm running SuperCollider using the
12-SuperCollider: 7-remote-control
script in the IDE, and then running some of the code here in a remote SC IDE. Everything's worked very smoothly apart from the bus issue. With the bus issue I never had any errors in the Bela IDE post window or the SC IDE post window, so it was really hard to figure out what was going on.I would put in a PR to change the remote-control script to set
s.options.numAudioBusChannels
ands.options.numControlBusChannels
, but I'm confused about what the number should be; is Bela intentionally using less than 1024 for performance reasons?The text was updated successfully, but these errors were encountered: