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

No GUI/Headless install for Linux #3407

Open
tloureiro opened this issue Jul 22, 2024 · 20 comments
Open

No GUI/Headless install for Linux #3407

tloureiro opened this issue Jul 22, 2024 · 20 comments

Comments

@tloureiro
Copy link

tloureiro commented Jul 22, 2024

I want to be able to install only the server, so I can send OSC messages to it using VScode. I have SuperCollider installed/running already.

  • What would be the necessary steps to build/run the server only?
  • Is there any documentation on Sonic Pi's architecture that can help me figure this out?

Thanks!


Edit: I ended up figuring it out for Ubuntu 24.04, and I started working on a VSCode extension Sonic Pi Studio

@tloureiro
Copy link
Author

tloureiro commented Jul 26, 2024

How to do install server only on Ubuntu 24.04

  • Clone this repo, checkout whatever branch you want, preferably a stable one
  • Run sudo apt install supercollider pipewire-jack ruby3.2 ruby3.2-dev build-essential cmake ninja-build pkg-config libssl-dev erlang-dev erlang-xmerl elixir
  • Comment out these 2 lines from sonic-pi/app/linux-build-all.sh
# "${SCRIPT_DIR}"/linux-config.sh "$@"
# "${SCRIPT_DIR}"/linux-build-gui.sh "$@"
  • Run ./linux-build-all.sh --system-libs

You should be able to start the server now.
Run ruby ./sonic-pi/app/server/ruby/bin/daemon.rb - some numbers will be printed out; these are port numbers (and the token number). If no OSC command is sent, the server shuts itself down after 90 seconds due to the Zombie Kil Switch

Testing method 1
Using a hacky/modified version of @rbnpi's gem.
It's a simple gem, you can download it, modify the sonic_pi4.rb file, remove/comment out the 2 break instructions in this file, and this should do the trick. Also, on sonic_pi4.rb, make sure you change the require 'sonic_piRBN.rb' to require './sonic_piRBN.rb'
Now you can run ruby sonic_pi4.rb play 72 and hear the note playing.

Testing method 2
The dev branch has the recent addition of Sonic Pi REPL (See @samaaron reply below with the video on how to use it)

@vomitHatSteve
Copy link
Contributor

So you do have an sonicpi server running and playing audio with this technique?

If no OSC command is sent, the server shuts itself down after some time

The timeout is, what? 3 seconds? How do you keep that from happening?

I've been fighting with with a headless mode since upgrading to version 4.x for a month or two. I'll try your techniques and see if I can get it working.

@vomitHatSteve
Copy link
Contributor

Also, what Linux distro are you on? I'm on Ubuntu 24.04 LTS

@tloureiro
Copy link
Author

tloureiro commented Jul 29, 2024

@vomitHatSteve

The timeout is of 90 seconds, I believe, and it's because of the Zombie Kil Switch - the GUI keeps it alive by constantly hitting a daemon OSC endpoint /daemon/keep-alive.

Right now I'm working on a VScode extension that will try to manage the OSC messaging and will also do some code syntax colouring and basic code completion

Also, what Linux distro are you on? I'm on Ubuntu 24.04 LTS

Xubuntu 24.04 - pipewire installed by default

Please let me know if you get stuck anywhere 👍

@tloureiro
Copy link
Author

tloureiro commented Jul 29, 2024

I'm still working on the vscode plugin, very early phases. Right now, you can start, stop, and play a test note using the vscode prompt. This is my developing branch https://github.com/tloureiro/sonic-pi-studio/tree/version-1

I'll work on sending the contents of the current file to the server next.

@samaaron
Copy link
Collaborator

Hiya,

I've just created a very simple barebones REPL to help people work on alternative front-ends:

05e49e4

@samaaron
Copy link
Collaborator

2024-07-29.20-00-04.mov

@tloureiro
Copy link
Author

@samaaron EXCELENT idea, thank you. I will update the instructions

@vomitHatSteve even easier way to to test if the install worked ok

@vomitHatSteve
Copy link
Contributor

vomitHatSteve commented Aug 17, 2024

And immediately after everyone else posted I got sick for a week and then went on vacation.
OK, so I got an opportunity to download the latest push and try the repl tool. My results were not good

Running as root (don't judge me)

I ran ./app/linux-clean.sh to clean up the previous install
Next ./app/linux-build-all.sh ran without error that I noticed
Then I rebooted to ensure no lingering processes
Then attempted the repl:

# ./bin/sonic-pi-repl.sh
-- Sonic Pi Daemon started with PID: 1350
-- Log files are located at: /root/.sonic-pi/log
-- OSC Cues port: 0
#<Thread:0x0000715fdedb5ce0 ../app/server/ruby/bin/repl.rb:50 run> terminated with exception (report_on_exception is true):
-- Waiting for Sonic Pi to boot...
/usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:113:in `block in encode_single_message': Unknown arg type to encode: nil (RuntimeError)
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:58:in `each'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:58:in `encode_single_message'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/udp_client.rb:32:in `send'
        from ../app/server/ruby/bin/repl.rb:65:in `block (2 levels) in initialize'
        from ../app/server/ruby/bin/repl.rb:64:in `loop'
        from ../app/server/ruby/bin/repl.rb:64:in `block in initialize'
#<Thread:0x0000715fdedb3d78 ../app/server/ruby/bin/repl.rb:76 run> terminated with exception (report_on_exception is true):
/usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:113:in `block in encode_single_message': Unknown arg type to encode: nil (RuntimeError)
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:58:in `each'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:58:in `encode_single_message'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/udp_client.rb:32:in `send'
        from ../app/server/ruby/bin/repl.rb:79:in `block in initialize'

^C
Killing the Sonic Pi Daemon...
The Daemon has been vanquished!

Farewell, artistic coder.
May you live code and prosper...


                                ╘
                         ─       ╛▒╛
                          ▐╫       ▄█├
                   ─╟╛      █▄      ╪▓▀
         ╓┤┤┤┤┤┤┤┤┤  ╩▌      ██      ▀▓▌
          ▐▒   ╬▒     ╟▓╘    ─▓█      ▓▓├
          ▒╫   ▒╪      ▓█     ▓▓─     ▓▓▄
         ╒▒─  │▒       ▓█     ▓▓     ─▓▓─
         ╬▒   ▄▒ ╒    ╪▓═    ╬▓╬     ▌▓▄
         ╥╒   ╦╥     ╕█╒    ╙▓▐     ▄▓╫
                    ▐╩     ▒▒      ▀▀
                         ╒╪      ▐▄

       _____             __        ____  __
      / ___/____  ____  /_/____   / __ \/_/
      \__ \/ __ \/ __ \/ / ___/  / /_/ / /
     ___/ / /_/ / / / / / /__   / ____/ /
    /____/\____/_/ /_/_/\___/  /_/   /_/

   The Live Coding Music Synth for Everyone

            http://sonic-pi.net


/usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:113:in `block in encode_single_message': Unknown arg type to encode: nil (RuntimeError)
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:58:in `each'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscencode.rb:58:in `encode_single_message'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/osc/udp_client.rb:32:in `send'
        from ../app/server/ruby/bin/repl.rb:61:in `block (2 levels) in initialize'
/usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:34:in `sleep': Interrupt
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:34:in `wait'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:34:in `block in get'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:32:in `synchronize'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:32:in `get'
        from ../app/server/ruby/bin/repl.rb:87:in `initialize'
        from ../app/server/ruby/bin/repl.rb:354:in `new'
        from ../app/server/ruby/bin/repl.rb:354:in `<main>'
/usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:34:in `sleep': Interrupt
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:34:in `wait'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:34:in `block in get'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:32:in `synchronize'
        from /usr/src/sonic-pi/app/server/ruby/lib/sonicpi/promise.rb:32:in `get'
        from ../app/server/ruby/bin/repl.rb:87:in `initialize'
        from ../app/server/ruby/bin/repl.rb:354:in `new'
        from ../app/server/ruby/bin/repl.rb:354:in `<main>'

I'm running Ubuntu 24.04 on an old Toshiba. The most notable hardware configuration I have going on is that there is a Lexicon Alpha USB interface plugged in. Its drivers work fine (aplay will play wavs)

I'll dig through more logs to see if I spot what went wrong, but if anyone else sees anything obvious, I'm all ears

@kootenpv
Copy link

How to do install server only on Ubuntu 24.04

  • Clone this repo, checkout whatever branch you want, preferably a stable one
  • Run sudo apt install supercollider pipewire-jack ruby3.2 ruby3.2-dev build-essential cmake ninja-build pkg-config libssl-dev erlang-dev erlang-xmerl elixir

I am confused, because when I try to run, it complains I don't have jackd installed. pipewire-jack has a different interface I believe than jack2, which is why I think they are not compatible? what am I missing

(I am using arch linux, not ubuntu, but don't think it makes a difference in this case)

@tloureiro
Copy link
Author

@vomitHatSteve have you tried running ./linux-build-all.sh with the flag --system-libs ?

@tloureiro
Copy link
Author

tloureiro commented Aug 22, 2024

@kootenpv Do you have supercollider installed? It might be a dependency, and apt will install it

Can you share the command and the output you ran? thanks!

@kootenpv
Copy link

@tloureiro I made a new issue to separate it (supercollider looks to be working from the logs) #3413

@vomitHatSteve
Copy link
Contributor

vomitHatSteve commented Aug 22, 2024

@vomitHatSteve have you tried running ./linux-build-all.sh with the flag --system-libs ?

I'll give it a try

Huh. It has repeatedly failed to find aubio, I'll have to figure that out

@vomitHatSteve
Copy link
Contributor

Huh. Yeah that install failed with

CMake Error at api/CMakeLists.txt:44 (find_package):
  Could not find a package configuration file provided by "platform_folders"
  with any of the following names:

    platform_foldersConfig.cmake
    platform_folders-config.cmake

  Add the installation prefix of "platform_folders" to CMAKE_PREFIX_PATH or
  set "platform_folders_DIR" to a directory containing one of the above
  files.  If "platform_folders" provides a separate development package or
  SDK, be sure it has been installed.

@tloureiro
Copy link
Author

@vomitHatSteve make sure you comment this 2 lines linux-build-all.sh

# "${SCRIPT_DIR}"/linux-config.sh "$@"
# "${SCRIPT_DIR}"/linux-build-gui.sh "$@"

@vomitHatSteve
Copy link
Contributor

@vomitHatSteve make sure you comment this 2 lines linux-build-all.sh

# "${SCRIPT_DIR}"/linux-config.sh "$@"
# "${SCRIPT_DIR}"/linux-build-gui.sh "$@"

I've done so many passes on this that I forgot that step! headdesk

Anyway, compilation completed. Then I got the same errors trying to run the repl as the first time.

@tloureiro
Copy link
Author

@vomitHatSteve were you able to run the server alone

ruby ./sonic-pi/app/server/ruby/bin/daemon.rb ?

@vomitHatSteve
Copy link
Contributor

@tloureiro, nope

# ruby ./sonic-pi/app/server/ruby/bin/daemon.rb
SuperCollider Audio Server Boot Error
could not initialize audio.
terminate called without an active exception
Error. Unable to write to log file: closed stream
#<IOError: closed stream>

And .sonic-pi/logs/daemon.log says...

[2024-08-27 12:47:02] Welcome to the Daemon Booter
[2024-08-27 12:47:02] ----------------------------
[2024-08-27 12:47:02] SuperCollider inputs enabled by GUI
[2024-08-27 12:47:02] Booting Scsynth
[2024-08-27 12:47:02] Got Audio Settings toml hash: {:sound_card_name=>"Alpha"}
[2024-08-27 12:47:02] Unified Audio Settings toml hash: {"-H"=>"Alpha"}
[2024-08-27 12:47:02] Combined Audio Settings toml hash with GUI scsynth inputs hash: {"-H"=>"Alpha"}
[2024-08-27 12:47:02] Merged Audio Settings toml hash: {"-u"=>"REDACTED", "-a"=>"1024", "-m"=>"131072", "-D"=>"0", "-R"=>"0", "-l"=>"1", "-i"=>"16", "-o"=>"16", "-b"=>"4096", "-B"=>"127.0.0.1", "-H"=>"Alpha"}
[2024-08-27 12:47:02] Using default pipewire buffsize of: 1024
[2024-08-27 12:47:02] Using default pipewire samplerate of: 48000
[2024-08-27 12:47:02] Starting scsynth with LD_LIBRARY_PATH set to "/usr/${LIB}/pipewire-0.3/jack" so it uses pipewire's jack
[2024-08-27 12:47:02] No need to start Jackd, using pipewire instead
[2024-08-27 12:47:02] Process Booter - booting scsynth
[2024-08-27 12:47:02] Waiting for the SuperCollider Server to have booted...
[2024-08-27 12:47:02] Sending /status to server
[2024-08-27 12:47:02] [scsynth] could not initialize audio.
[2024-08-27 12:47:02] [scsynth] terminate called without an active exception
[2024-08-27 12:47:03] Unable to connect to SuperCollider
[2024-08-27 12:47:03] Extracting Scsynth info
[2024-08-27 12:47:03] sending ERROR to gui
[2024-08-27 12:47:03] ----
[2024-08-27 12:47:03] Selected ports:
[2024-08-27 12:47:03] {"spider-listen-to-gui"=>31605, "gui-send-to-spider"=>31605, "gui-listen-to-spider"=>31606, "spider-send-to-gui"=>31606, "scsynth"=>31607, "scsynth-send"=>31607, "osc-cues"=>4560, "tau"=>31608, "spider"=>31609, "phx"=>31610, "daemon"=>31611, "spider-listen-to-tau"=>31612}
[2024-08-27 12:47:03] Token: 1496101040
[2024-08-27 12:47:03] ----
[2024-08-27 12:47:03] Daemon Booter is now exiting.
[2024-08-27 12:47:03] Cleaning up any running processes...
[2024-08-27 12:47:03] Process Booter - no need to kill scsynth with pid 772933 and args ["-u", "31607", "-a", "1024", "-m", "131072", "-D", "0", "-R", "0", "-l", "1", "-i", "16", "-o", "16", "-b", "4096", "-B", "127.0.0.1", "-H", "Alpha"] - already terminated, wait_thr status: #<Process::Waiter:0x00007be11eb13228 dead>, false
[2024-08-27 12:47:03] Daemon Booter - Over and Out.

debug.log is empty

scsynth.lgo contains

could not initialize audio.
terminate called without an active exception

@vomitHatSteve
Copy link
Contributor

Now, I am able to get a supercollider instance running if I manually use the settings that SP does and start an instance of Jackd first

I have yet to get any output from it tho

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

No branches or pull requests

4 participants