crucialfelix / supercolliderjs

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

Ubuntu error, no sound with jackd #38

Open abdelaz3r opened 6 years ago

abdelaz3r commented 6 years ago

Hi,

I'm trying to run supercolliderjs for a while and there is a big problem. I literally tried with a friend of mine for a whole day to understand why supercolliderjs doesn't work. So, first my config:

OS: Ubunut 16.04

Sound card:

0 [PCH            ]: HDA-Intel - HDA Intel PCH
                     HDA Intel PCH at 0xf1240000 irq 127

Background:

First I installed Supercollider (scide, sclang, scsynth). This works. I run the supercollider client, that is starting jackd, and I can play music. After that I made some tests with Overtone (clojure binding over supercollider). Again it worked, I just had to start jackd myself, but that was ok.

Problem:

I installed supercolliderjs and first, I had problems with executable path. Here is my supercollider.yaml:

sclang: /usr/local/bin/sclang
sclang_conf: /home/abdelaz3r/.config/SuperCollider/sclang_conf.yaml
scsynth: /usr/local/bin/scsynth

After doing test, the code that a run (the server.js example on this github page), doesn't produce errors anymore but there is no sound at all. I tried to start jackd the exact same way than supercollider did (by inspect the starting process command in htop).

Is anyone have had the same thing. Is there problem on ubuntu, or with jackd. Maybe conflict with overtone. I don't know and don't see what I can do now.

I can provide some other output is it's necessary.

Thanks a lot.

crucialfelix commented 6 years ago

Hi,

This is what you need to set:

https://github.com/crucialfelix/supercolliderjs/blob/60ca4c01705836ce3e1b0f5e837fa390c4f75b4c/src/server/default-server-options.js#L45

In your supercollider.yaml you can set environment variables. These are set when supercollider.js starts scsynth and this is what scsynth looks for to connect to jack.

SC_JACK_DEFAULT_INPUTS: "system:capture_1,system:capture_2" 
SC_JACK_DEFAULT_OUTPUTS 
SC_SYNTHDEF_PATH 
SC_PLUGIN_PATH

I'm not exactly sure what to set there. I'm on mac and haven't used jack.

See: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/jack-default-inputs-amp-Outputs-td7608142.html

I really wish I could find the time to increase the documentation and guides. Alas, my day job is swallowing my life.

It should be documented here (but isn't): https://crucialfelix.gitbooks.io/supercollider-js-guide/content/lang/install-and-configuration.html

abdelaz3r commented 6 years ago

Hi and thanks for spending time to my problem.

I read and tried some stuff you put on your message.

My final supercollider.yaml file looks like:

sclang: /usr/local/bin/sclang
scsynth: /usr/local/bin/scsynth

sclang_conf: /home/abdelaz3r/.config/SuperCollider/sclang_conf.yaml

debug: true
echo: true
stdin: true
langPort: 57120
serverPort: 57110
host: 127.0.0.1
protocol: udp
websocketPort: 4040

SC_JACK_DEFAULT_INPUTS: " system:capture_1,system:capture_2"
SC_JACK_DEFAULT_OUTPUTS: "system:playback_1,system:playback_2"

But no sound. I will try again to find something in relation in order to solve that. I also attach a gist that show the output of the node server.js command: https://gist.github.com/abdelaz3r/d6a0405a4e7827f9112804c8eb6680df

Thanks again.

crucialfelix commented 6 years ago

I think your settings should be something like this:

env:
    SC_JACK_DEFAULT_INPUTS: "system:capture_1,system:capture_2"
    SC_JACK_DEFAULT_OUTPUTS: "system:playback_1,system:playback_2"

I mean that env is a dict of environment settings. You don't add them to the top root level.

Sorry I wasn't clear before.

abdelaz3r commented 6 years ago

It works, thanks a lot !