crucialfelix/supercolliderjs

Don't see any way to pass sclang options

ivxvm opened this issue · 5 comments

ivxvm commented

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

running into this as well

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:

export interface SCLangOptions {
debug: boolean;
echo: boolean;
log?: Console;
// path to sclang executable
sclang: string;
// To start sclang and immediately execute one file
executeFile?: string;
// path to existing conf file
sclang_conf?: string;
stdin: boolean;
failIfSclangConfIsMissing: boolean;
conf: SCLangConf;
}

sclang option is the path to the sclang executable.

default options are:

function defaultOptions(): SCLangOptions {
const opts: SCLangOptions = {
debug: false,
echo: true,
stdin: false,
sclang: "sclang",
failIfSclangConfIsMissing: false,
conf: {
includePaths: [],
excludePaths: [],
postInlineWarnings: false,
},
};
switch (os.platform()) {
case "win32": {
const defaultRoot = "C:\\Program Files (x86)\\SuperCollider";
opts.sclang = path.join(defaultRoot, "sclang.exe");
// eslint-disable-next-line @typescript-eslint/camelcase
opts.sclang_conf = path.join(defaultRoot, "sclang_conf.yaml");
break;
}
case "darwin": {
opts.sclang = "/Applications/SuperCollider/SuperCollider.app/Contents/MacOS/sclang";
// eslint-disable-next-line @typescript-eslint/camelcase
opts.sclang_conf = `${os.homedir()}/Library/Application Support/SuperCollider/sclang_conf.yaml`;
break;
}
default: {
const defaultRoot = "/usr/local/bin";
opts.sclang = path.join(defaultRoot, "sclang");
// eslint-disable-next-line @typescript-eslint/camelcase
opts.sclang_conf = "/usr/local/share/SuperCollider/sclang_conf.yaml";
}
}
return opts;
}

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

You pass the options in

new SCLang(options: SCLangArgs)

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

});

thx! Got it working.

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