crucialfelix / supercolliderjs

The JavaScript client library for SuperCollider
https://crucialfelix.github.io/supercolliderjs/
MIT License
472 stars 41 forks source link

Don't see any way to pass sclang options #120

Open ivxvm opened 1 year ago

ivxvm commented 1 year ago

I found a way to specify scsynth executable path, but I don't see a similar way to specify sclang path. Get the following error when trying to run the very first example from docs:

Error: spawn C:\Program Files (x86)\SuperCollider\sclang.exe ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Program Files (x86)\\SuperCollider\\sclang.exe',
  path: 'C:\\Program Files (x86)\\SuperCollider\\sclang.exe',
  spawnargs: [
    '-i',
...

PS: Sure I have SC installed, but I have x64 version and it's located in different folder, so I need a way to provide executable path

dskill commented 1 year ago

running into this as well

crucialfelix commented 1 year ago

Hello, really sorry everyone for the late response.

The documentation does have broken links and I didn't manage to get it to link all the options arguments correctly.

Language interpreter

https://crucialfelix.github.io/supercolliderjs/#/packages/lang/SCLang

The options are: https://github.com/crucialfelix/supercolliderjs/blob/2e7c2b4819cd19346656755d1cf37bf6cea37d04/packages/lang/src/options.ts#L19-L33

sclang option is the path to the sclang executable.

default options are:

https://github.com/crucialfelix/supercolliderjs/blob/2e7c2b4819cd19346656755d1cf37bf6cea37d04/packages/lang/src/options.ts#L63-L100

audio Server

https://crucialfelix.github.io/supercolliderjs/#/packages/server/Server

The scsynth option in the path to scsynth executable:

https://github.com/crucialfelix/supercolliderjs/blob/develop/packages/server/src/options.ts#L90-L136

crucialfelix commented 1 year ago

You pass the options in

new SCLang(options: SCLangArgs)

// or I think:
sc.lang.boot({ sclang: 'path/to/sclang' }).then(async function(lang) {

});
dskill commented 1 year ago

thx! Got it working.

Mouradif commented 10 months ago

The option seems to be ignored. I boot with:

const sc = require("supercolliderjs");

sc.server.boot({
  scsynth: '/Applications/SuperCollider.app/Contents/Resources/scsynth',
  sclang: '/Applications/SuperCollider.app/Contents/MacOS/sclang'
}).then(async server => {

but it still fails with the error:

Error: spawn /Applications/SuperCollider/SuperCollider.app/Contents/MacOS/sclang ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Notice that it tries to open /Application/SuperCollider/SuperCollider.app/ despite me explicitly passing the correct path in the boot options.

By the way, the path I'm passing (without the nested SuperCollider folder inside /Applications) seems to be the default when installing SuperCollider now