Skip to content
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

How to connect together scsynth and sclang in the same nodejs app. #72

Closed
fibonacid opened this issue Dec 2, 2019 · 2 comments
Closed
Labels

Comments

@fibonacid
Copy link

fibonacid commented Dec 2, 2019

What is the simplest way to connect an interpreter and a server in the same nodejs application.
This should be the desired behavior:

Setup

  • boot scsynth
  • boot sclang

Runtime

When a user input some text:

  • feed sclang with input
  • dispatch result to scsynth
  • (hear a sound)

Version

v1.0.0.beta.1

@crucialfelix
Copy link
Owner

In this case you are using sclang to play the sound, so I think you should keep it simple and start the server from sclang as normal:

Server.default.boot;

Try that first.

I could add some way to boot both and to get sclang to connect to the already running scsynth. This would have two advantages:

  • It would boot faster: don't have to wait for sclang to come up before starting scsynth
  • If your node/electron app shuts down then the scsynth process will be shut down correctly because it is a child process of the node process.

Something like this would work, but I haven't tested it yet:

Promise.all([
  sc.server.boot(),
  sc.lang.boot()
]).then(async ([server, lang]) => {

  // figure out what the correct values here are:
  await lang.interpret(`Server.default = Server.remote(name, addr, options, clientID)`);
  // now you can run code as if the server and lang are already booted
})

@fibonacid
Copy link
Author

That's great, thanks !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants