ofxSupercolliderServer on linux64

i’m trying the ofxSupercolliderServer @satoruhiga addon on linux64 OS, i added the linux64 static libs and done little changes in the code. I suppose that with this addon you can start your app without run jack and scsynth, the ofxSuperColliderServer just boot the server with all necessary and the OF app send to the server. But when i run the app from a console jackd do not start properly see the log:

 ./example
Using vector unit: yes
Loading synthdefs from path: /home/walter/.local/share/SuperCollider/synthdefs
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jackdmp 1.9.8
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2011 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
control device hw:0
control device hw:0
Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Failed to acquire device name : Audio0 error : Invalid argument
Audio device hw:0 cannot be acquired...
Cannot initialize driver
JackServer::Open() failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
could not initialize audio.
Errore di segmentazione (core dump creato)

Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
i searched with google the error reporting this line. in different topic founded i realize that i have to create a script to let jackd start without display…

so my script:

#! /bin/bash
# file: /home/user/data/script/jackstart
#
# This is ridiculous:
export DISPLAY=:0

# dbus-launch started, DBUS_SESSION_BUS_ADDRESS exported:
export `dbus-launch | grep ADDRESS` 

# dbus-launch started, DBUS_SESSION_BUS_PID exported
export `dbus-launch | grep PID` 
/usr/bin/jackd -dalsa -dhw:0 -r48000 -p1024 -n2 -Xseq
cd bin
 ./example

but this do not cahnge nothing. Someone has an idea how to solve it?

Anyone has an idea how to solve this or to find another solution? My naother idea was to start the scsynth server, jackd and my app with all in one script. But because i lack in scripting knowledge and skills, what i was able to do was to run a script that start the sc server jackd and instead my OFapp won’t start: this is my script ( basically like the above script, in my previous post):

 #! /bin/bash
    
/usr/bin/jackd -dalsa -dhw:0 -r48000 -p1024 -n2 -Xseq 
sclang boot.scd

cd bin
./atsukiExample_debug		

boot.scd

s = Server.default; 	
s.boot; 

this is the log from console:

walter@walter-RC530-RC730:~/OF0072/openFrameworks/examples/atsukiExample$ sudo r./runApp.sh
[sudo] password for walter: 
sudo: r./runApp.sh: comando non trovato
walter@walter-RC530-RC730:~/OF0072/openFrameworks/examples/atsukiExample$ sudo ./runApp.sh
init_OSC
empty
compiling class library (debug build)...
	NumPrimitives = 679
	compiling dir: '/usr/share/SuperCollider/SCClassLibrary'
	compiling dir: '/usr/share/SuperCollider/Extensions'
	compiling dir: '/home/walter/.local/share/SuperCollider/Extensions'
	pass 1 done
	numentries = 895325 / 14117180 = 0.063
	5665 method selectors, 2492 classes
	method table size 14027680 bytes, big table size 112937440
	Number of Symbols 13245
	Byte Code Size 468951
	compiled 405 files in 1.91 seconds

Info: 2 methods are currently overwritten by extensions. To see which, execute:
MethodOverride.printAll

compile done
Help tree read from cache in 0.022106885910034 seconds
LID: event loop started
Class tree inited in 0.05 seconds
WARNING: Deprecated startup file found: ~/.sclang.sc

Please use /home/walter/.config/SuperCollider/startup.scd as startup file.
Deprecated startup files will be ignored in future versions.

Open ended comment ... started on line 1 in file 'selected text'

WARNING:  redDefault hack just replaced the file default.scsyndef in your synthdefs directory.
 to get back to boring normal, delete this file (ie default.scsyndef), uninstall redDefault
 with the command Quarks.uninstall("redDefault"), and recompile.
 thank you for choosing red inc systems.
RESULT = 0
Welcome to SuperCollider 3.6.6. For help type ctrl-c ctrl-h (Emacs) or :SChelp (vim) or ctrl-U (sced/gedit).
booting 57110
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jackdmp 1.9.8
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2011 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
control device hw:0
control device hw:0
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
port created: Midi-Through:midi/playback_1
port created: Midi-Through:midi/capture_1
port created: TiMidity:midi/capture_1
port created: TiMidity:midi/capture_2
port created: TiMidity:midi/capture_3
port created: TiMidity:midi/capture_4
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 48000.000000, driver's block size = 1024
JackDriver: connected  system:capture_1 to SuperCollider:in_1
JackDriver: connected  system:capture_2 to SuperCollider:in_2
JackGraphManager::Connect different port types port_src = 5 port_dst = 13
JackDriver: couldn't connect  system:midi_capture_1 to SuperCollider:in_3
JackDriver: connected  SuperCollider:out_1 to system:playback_1
JackDriver: connected  SuperCollider:out_2 to system:playback_2
JackGraphManager::Connect different port types port_src = 21 port_dst = 6
JackDriver: couldn't connect  SuperCollider:out_3 to system:midi_playback_1
JackGraphManager::Connect different port types port_src = 22 port_dst = 7
JackDriver: couldn't connect  SuperCollider:out_4 to system:midi_playback_2
JackGraphManager::Connect different port types port_src = 23 port_dst = 8
JackDriver: couldn't connect  SuperCollider:out_5 to system:midi_playback_3
JackGraphManager::Connect different port types port_src = 24 port_dst = 9
JackDriver: couldn't connect  SuperCollider:out_6 to system:midi_playback_4
JackGraphManager::Connect different port types port_src = 25 port_dst = 10
JackDriver: couldn't connect  SuperCollider:out_7 to system:midi_playback_5
SuperCollider 3 server ready (debug build).
JackDriver: max output latency 42.7 ms
Receiving notification messages from server localhost
Shared memory server interface initialized

as you can see the OFapp not start but if after this script i run the OFapp i have the sound, so i think i’m very close to it.

i found a solution! I’m creating a little addon for this.
1): i think that something is changed in OF core audio that inhibit jackd, you can not run scsynth from an Openframeworks app.
2) i solved running sclang in a shell scriptl like this:

 #! /bin/bash

sclang boot.scd &

cd bin
./atsukiExample_debug 

the trick is the “&” charachter that put in the background the procees invoked. In your testApp in exit you need also a function that send a /quit message to server other wise the sound won’t stop. Soon i will put this on my github rep…

Here the code at ofxSuperColliderBoot

Hi Kalwalt, im a little confused with getting the ofxSuperColliderBoot to trigger any sound. Is there something im not setting up correctly. DO i need super collider open in the background? Do I need to write a synth for it to play? Or is this all happening in openFrameworks somehow (if so then AMAZING) Would you be able to talk me through this a little… Thanks

hi @joshuabatty, the problems with the sound probably is caused by Jack. The script ‘run.sh’ should start sclang ( the language Supercollider interpreter) and as consequence start also jack(because we run sclang with the sript boot.scd) , i will try to help you and find the reason you are not listening a sound from your app. first i give you some answer:

 DO i need super collider open in the background? .

no, because we run sclang with the script run.sh

Do I need to write a synth for it to play? `

yes, this is the only thing you have to do. i forgot to add the synth, grabb it here, and try with this:

SynthDef(\simple_sine, {
	arg outbus=0, freq=440, pan=0.5, lfoFreq=1.0, amp=0.5;
	var mix, lfo;
	lfo = SinOsc.kr(lfoFreq,0,0.5);
	mix = Pan2.ar(SinOsc.ar(freq,0,amp*lfo),pan);
	Out.ar(0, mix);
}).store;

You need of course to have supercollider installed on your machine. Run the app in a console, in this way you can check if jack, sclang and the OF app start properly, if jack not start, try to start it ( qjack for example) running the OF app. I think that could be differences, because different version of Supercollider and maybe a different startup.scd ( the file in which supercollider look at the beggining, in linux usually is an hidden file in /home/yourFolderName/.config/SuperCollider) .
One of my difficulties was to setup everything in the right way probably it’s possible to improve this, for example using the [ofxJackClient][1] addon and so running jack at the beggining.
Let me know if this help you or not. I will try again on my machine on Ubuntu 14.04, maybe i missed something. I am a super Supercollider fan, and i would to see more perople using it within OF!
[1]: https://github.com/gameoverhack/ofxJackClient

Thanks for the reply @kalwalt ! so i’ve copied your super collider synth and save it as simple_sine.scd and put that in /data/synthdefs/ … is this correct. Looking at ofxSuperColliderServer addon the examples are in .scsyndef not .scd format. Sorry for my nOOb’ness here but I can only seem to get .scsyndef files to make sound and not .scd, also I dont seem to know how to turn a .scd file into a .scsyndef file if that is the case. Does this make sense or am I way off? cheers…

so i've copied your super collider synth and save it as simple_sine.scd and put that in /data/synthdefs/ ..... is this correct.

no this is not correct. @joshuabatty ofxSuperColliderServer works on different basis, i meant that the .scsyndef path point to /data/synthdefs/. instead usually scsyndef are in a hidden folder usually in:

/home/yorurFolderName/.local/share/SuperCollider/synthdefs

and also renaming a simple text file in .scyndef doesn’t works because scyndef format is in bytecode. Instead you should open gedit with supercollider enabled or the new scide ide, copy and paste the synth in it, select all the text and go to scide > Language/Evaluate Selection, Line or Region, and in the console of scide or gedit it will appear a message like this:

a SyntDef

this means that a .scsyndef is stored in the hidden folder (or where you want to save it…), ready to used. You can test running this command:

Synth("simple_sine")

Theoretically now the ofxSuperolliderBoot example should works, but unforunately yesterday i tried it and didn’t works, I have to say that i upgraded from ubuntu 12.04 to 14.04, with a newer Supercollider version and OF 0.81, i need to investigate. I would to know if you have success or not with it, and if you encountered other types of issues

Thanks for explaining that kalwalt. I am going to have to put super collider -> oF to the side for a few months while i finish off my thesis but am still interested to get this working. Please let me know if you manage to get it working on your end again. Cheers.