Hello there,
I am having difficulties live coding Bela from the SuperCollider IDE on my laptop.

SC–Bela documentation reference

I see that this issue has already been addressed in several threads e.g. Sclang on bela? e.g. SuperCollider through Bela IDE, yet I still can’t get connection between SC IDE and bela to work.

On this page I read:
“It’s also possible to live code Bela from the SuperCollider IDE. Download the Bela class files and follow the instructions in the README file to set it up. This setup allows you to execute code on your laptop, directly communicating with scsynth running on your Bela in real time.”
(NB the link to bela class files is a dead link)

Workflow

I am using the Bela SC example 7-Remote-control/remote.scd

This is my workflow:
1. Bela is connected to laptop via USB
2. On browser (bela.local) I run the following code (reduced version of _main.scd):

s = Server.default;

// Set up options for the Bela
s.options.numAnalogInChannels = 2;
s.options.numAnalogOutChannels = 2;
s.options.numDigitalChannels = 0;
s.options.maxLogins = 4;

s.options.blockSize = 16;
s.options.numInputBusChannels = 2;
s.options.numOutputBusChannels = 2;

s.waitForBoot {
};

ServerQuit.add({ 0.exit }); // quit if the button is pressed

3. I run this code from my SuperCollider IDE (version 3.11.2)

( // connect to the already-running remote belaserver
Server.default = s = Server("belaServer", NetAddr(“XXX.XXX.X.XX”, 57110)); // In the NetAddr I am pasting my IP address
s.options.maxLogins = 4; // should match the settings on the Bela
s.initTree;
s.startAliveThread;
);

When I run this:
- The interpreter is active
- The server is not (yellow values in SC IDE)

In fact, running s.plotTree and attempting any further computation triggers this message in the post window:
WARNING: Server failed to respond to Group:queryTree!
WARNING: server 'belaServer' not running.

Am I using the wrong NetAddr? (using Bela’s IP address is no better)

I would be very thankful for some help!

    purple_grass Server.default = s = Server("belaServer", NetAddr(“XXX.XXX.X.XX”, 57110)); // In the NetAddr I am pasting my IP address

    here you should be using the the server's (i.e.: Bela's) address. This is the same address at which you access the Bela IDE (on most systems, this is bela.local, or 192.168.7.2 or 192.168.6.2 ).

    If you are running the latest version of Supercollider on Bela, then you'll need to add a

    s.options.bindAddress = "0.0.0.0";

    to the .scd file on the board before starting the server, or it won't let you log into that server from another host.

    I updated the examples on our public repo to reflect this: https://github.com/BelaPlatform/Bela/commit/d7da7f0473863f75a600a2f91550f4994ab41769

      giuliomoro

      Thanks for this. The addresses"bela.local"and "192.168.7.2"work for my machine: the connection is established.

      After receiving your advice I noticed that I still needed to add the class files for the Bela-specific UGens to my computer, which I think was the reason why the connection couldn't be established in the first place...

      I don't have the latest SC version on Bela (let sleeping dogs lie) so I run the _main.scd (7-remote-control) without the s.option.bindAddress = "0.0.0.0" addition - works fine for now!

      Now I can really get started! Thanks a lot

        purple_grass

        P.S.
        may I suggest to re-link the "Bela class files" hyperlink on this page to the page it points to?
        Could be helpful to others who are learning to setup the remote connection.

          purple_grass which I think was the reason why the connection couldn't be established in the first place...

          Actually that was not the reason. The lack of the class files on the host would mean the ugens such as AnalogIn or DigitalIn wouldn't work, but the connection should be established regardless.

          purple_grass may I suggest to re-link the "Bela class files" hyperlink on this page to the page it points to?

          will do, thanks.

          By the way, from Sc 3.12, these files will be available to every Sc user without need to install them separately, so hopefully that will make things easier.