Hey! Newcomer on the forum here
I was wondering if someone could point me in the right direction of running a supercollider server from my c++ project and interacting with it from there also?
I’ve been looking at the source code but am struggling to get my head around it!
EDIT: Just to further clarify, I’d like to be able to run a supercollider server from my c++ project and use a ugen(?)/scsynth in this project
It would be so much simpler if you ran sclang as a background process, like in with bash, and then interacted with it using OSC. Would that be possible instead? If not, I have no idea, but would be interested in the answer, I know that scsynth can be complied as a library, I’m not sure how you would link to it, (without compling from source) but I imagine its do-able…
There is something called libscsynth that does this. Well, there was. It fell out of maintenance and was never documented.
If I wanted to use UGen DSP code in C++, I’d either just copy the UGen code and refactor all the SC-specific details, or for more standard things like oscillators and filters there are pre-existing C++ libraries like kfrlib or Q. Some of those libraries may have better DSP than SC’s UGens, not to mention a nicer API.
“It would be so much simpler if you ran sclang as a background process, like in with bash, and then interacted with it using OSC”
if i’m honest, i think this is what i had in mind initially - i guess then it would be as simple as running terminal/bash commands using the system() function? How would this look?
now i’m also curious now what it would mean to have it compiled as a usable library and to run the whole process from within your own project?
“There is something called libscsynth that does this. Well, there was. It fell out of maintenance and was never documented.”
I did come across libscsynth in a really old forum post but can’t actually find the github page for it unfortunately! is it still around?
libscsynth is just scsynth compiled as a shared library with a few exported functions. There is not much to maintain in the first place. The API can be found here: supercollider/SC_WorldOptions.h at develop · supercollider/supercollider · GitHub
In the simplest case, you only need three functions:
World_New: create the server instance
World_SendPacket: send messages to the server
World_CleanUp: free the server instance
You can build
libscsynth by enabling the
LIBSCSYNTH CMake option.
Ah. Sorry for spreading misinformation! If anyone wants to provide some good docs for libscsynth, perhaps using doxygen or the like, I’m sure the community would benefit from it.