Sonic Pi as an appimage

It’s a great idea. I just currently don’t have the resources to support linux at this point. However, if a member of our community was interested in creating and supporting an app image, that’s something I would hugely encourage :slight_smile:

Hello Sam, I’m glad you like the idea. I do understand being strapped for resources, been there myself a few times. :slight_smile: I’ll look into this and see what can be done. As a linux user since the early Slackware days I’m sure something can be accomplished. :slight_smile:

I’ll post back here with my progress.

Cheers.

2 Likes

That would be fabulous. I’m sure there are others here that will both cheer you on and also potentially be in a position to offer some support :slight_smile:

Please do let us know how you get on…

Thank you for starting this thread, and graze mille for offering to give it a start. I would be a very happy for the twenty Ubuntu laptops that are in my class room.

1 Like

It would be wonderful. After months of efforts, I’ve just achieved to run Sonic Pi in the computers of my school, but I would be great to have newer versions (we are on Sonic Pi 2.10) and easy to install.

I appreciate the encouragement! The work is being done in 3 stages, compiling SP itself, packaging via the appimage tools and then a limited testing distribution. For testing, with Sam’s approval, I’d like to see it perhaps tested by forum users on as many distros as possible before a wider release to check for compatibility, bugs, tweaking, etc.

Anyway, that’s the plan. I suspect the most time-consuming part will be to get a suitable compiling environment set up. Sonic Pi is a bit of beast to compile with all it’s dependencies and versioning requirements. My current work PC runs Lubuntu 19.04 with their new LXQt desktop (which is a really nice release btw) but is not setup for development. I decided instead to re-purpose an older PC I have with an install of Ubuntu 18.04 (more mainstream) for this project. That’s where I am now.

AND, a big THANK YOU! to Robin Newman as I’m using his post on compiling for Raspberry Pi as a help guide to get this project started: Building SP3.2dev from source on a Pi4

Keep you posted. Cheers.

5 Likes

Hi there,

would be really nice to have something like that. It will maybe get hard with the audio integration (jackd etc.).
I wish you all the best to get it running :slight_smile:

Cu.

Just a short note. My apologies for not making more progress on this. Work right now is consuming most of my time. This election year has created some wonderful programming opportunities for me and the money is pretty enticing. I hope to return and finish the project as soon as my situation changes.

Cheers.

I have to abandon this project for the time being as I simply don’t have any time to devote to it. My apologies to all. I’ll look into picking it up after the elections are over and (hopefully) I’ll get some of my life back.

Cheers to all.

I’d like to take a crack at this myself. I discovered Sonic Pi only recently, and my first hurdle has been to get it running on my Linux laptop. I’ve managed to get version 3.2 to build and run on it, and my next thought was that something like appimage is desperately needed to make running it easier. I thought I’d check for any existing work first and found this thread. @TheTraveler, do you have a start to this I could build on to avoid duplicating work?

The build environment is definitely a challenge for this project. For repeatability I plan to use docker.

I’m busy myself with work and other things, so I don’t know how quickly I’ll be able to get it up and running, but this is definitely an interesting project that I want to work on.

Please do. I didn’t make much of dent in this so I don’t have anything to contribute really. There were a couple of looming issues, the first being able to use whatever audio subsystem is installed on a users box. The choices are usually ALSA or pulseaudio. However, pulseaudio, while being found in most distros isn’t as popular as the devs would like in the “music on linux” community. ALSA has been around a lot longer, stable and very well supported. For instance, the first thing I strip off a new install is pulseaudio and install ALSA. The second issue for me was simply no time. I do some, er, “sensitive” work for clients and the upcoming election inundated me with work. Still at it despite the COVID-19 crisis. (The downside of being well networked and working from home I guess.) :wink: Lastly, Sam had a new version on the horizon that I think would have broken things.

So, I’m sorry I can’t be of more help. I wish you good fortune and if you start another thread, I’ll be sure to tag if if I can be of any help.

Cheers and stay well.

1 Like

It’s taken me a while, but I’ve gotten an appimage built. I’ve put it on github at https://github.com/spencerschumann/sonic-pi-appimage/releases/tag/v3.2.0-0.0.1. Testers welcome! For this release, you’ll need to make sure Jack is up and running. I’m hoping to eventually make it audio-backend independent, and support Jack, ALSA, and portaudio.

1 Like

Hi @spencerschumann,

sounds really great! Could you check the link? The one you provided gives a 404.

@Martin give it another try; I had forgotten that my github repo was private. I’ve made it public now.

1 Like

Hi @spencerschumann,

just a quick note: Great work! Runs on my laptop (Linux Mint 19.3). I will use it the next days and report back if something doesn’t work as expected (which seems unlikely to me). Thanks a lot!

hello @spencerschumann,

First thanks for your work !

i have downloaded the Appimage and as i have never used Appimage before i have to find the commands to test :slight_smile: . a little README.md ?

chmod a+x sonic-pi.AppImage
./sonic-pi.AppImage 

The install no pb on my ubuntu 18.04.04 system, very handy, very very handy :slight_smile:
but i encountered issues with osc.

# test on spi 3.2.2 on ubuntu-18.04.04
# nlb - 14042020

use_osc "localhost", 4560


##| n = 0.565656
##| puts n.round(2)
##| n_string = "0.98989989898"
##| n_float = n_string.to_f
##| sample :ambi_piano, amp: n_float


live_loop :sendMe do
  osc "/osc/note", (line 60, 120, steps: 4, inclusive: true).tick
  osc "/osc/oi", (ring 0.5, 1, 1.5, 2).tick('amp')
  ##| sleep [0.5, 0.125, 1.66666, 2].choose
  sleep 4
  
end

live_loop :oscheck do
  use_real_time
  c_value = sync "/osc:127.0.0.1:4560/osc/note"
  amp_value = sync "/osc:127.0.0.1:4560/osc/oi"
  
  sample :ambi_piano, amp: amp_value[0], cutoff: c_value[0]
end

i get this :

Runtime Error: [buffer 0, line 15] - Errno::ECONNREFUSED
Thread death +--> :live_loop_sendMe
 Connection refused - send(2)
/tmp/.mount_sonic-qyKsKd/bundles/bundle/var/build/sonic-pi/app/server/ruby/lib/sonicpi/osc/udp_client.rb:35:in `send'

This piece of code works on spi v3.2.2.

But as far as i understand, your appimage is based on the 3.2.0 version. I guess lots of changes since.
tell me what you want me to send you as logs to help you !

Otherwise is appimage file is a sort of a docker file or something like that ?
(edit : Little intro )

Cheers

First, congratulations on getting to this point! :slight_smile: Creating an AppImage is no easy thing. Unfortunately, it didn’t start for me. I have jack running and ALSA is available. Here is the start-up and error logs :

`Sonic Pi Boot Error Report

System Information

  • Sonic Pi version: 3.2.0
  • OS: Ubuntu 19.10

GUI Log

/home/****/.sonic-pi/log/gui.log

[GUI] - Welcome to the Sonic Pi GUI
[GUI] - ===========================
[GUI] -                            
[GUI] - {a5baa4fa-84ca-4337-8b08-3482ae91723c}
[GUI] - Discovering port numbers...
[GUI] - Port entry server-listen-to-gui : 51235 : 51235
[GUI] - Port entry gui-send-to-server : 51235 : 51235
[GUI] - Port entry gui-listen-to-server : 51236 : 51236
[GUI] - Port entry server-send-to-gui : 51236 : 51236
[GUI] - Port entry scsynth : 51237 : 51237
[GUI] - Port entry scsynth-send : 51237 : 51237
[GUI] - Port entry osc-midi-out : 51238 : 51238
[GUI] - Port entry osc-midi-in : 51239 : 51239
[GUI] - Port entry server-osc-cues : 4560 : 4560
[GUI] - Port entry erlang-router : 51240 : 51240
[GUI] - Port entry websocket : 51241 : 51241
[GUI] - Detecting port numbers...
[GUI] - GUI listen to server port 51236
[GUI] -    port: 51236 [OK]
[GUI] - Server listen to gui port 51235
[GUI] -    port: 51235 [OK]
[GUI] - Server incoming OSC cues port 4560
[GUI] -    port: 4560 [OK]
[GUI] - Scsynth port 51237
[GUI] -    port: 51237 [OK]
[GUI] - Server send to GUI port 51236
[GUI] -    port: 51236 [OK]
[GUI] - GUI send to server port 51235
[GUI] -    port: 51235 [OK]
[GUI] - Scsynth send port 51237
[GUI] -    port: 51237 [OK]
[GUI] - Erlang router port 51240
[GUI] -    port: 51240 [OK]
[GUI] - OSC MIDI out port 51238
[GUI] -    port: 51238 [OK]
[GUI] - OSC MIDI in port 51239
[GUI] -    port: 51239 [OK]
[GUI] - Websocket port 51241
[GUI] -    port: 51241 [OK]
[GUI] - All ports OK
[GUI] - launching Sonic Pi Runtime Server:
[GUI] - Ruby server pid registered: 2366
[GUI] - hiding main window
[GUI] - initialising toolbar icons
[GUI] - setting up window structure
[GUI] - restoring scope states 
[GUI] - creating status bar
[GUI] - creating info panel
[GUI] - creating shortcuts
[GUI] - creating tool bar
[GUI] - initialising documentation window
[GUI] - wait for sync
[GUI] - waiting for Sonic Pi Server to boot...
[GUI] - starting UDP OSC Server on port 51236...
[GUI] - UDP OSC Server ready and listening
............................................................
[GUI] - Critical error! Could not boot Sonic Pi Server.
[GUI] - stopping UDP OSC Server...
[GUI] - Critical Error. Unable to connect to server..
[GUI] - UDP OSC Server no longer listening

Server Errors

/home/****/.sonic-pi/log/server-errors.log

Failed to load the fast_osc c-extension, falling back to pure Ruby version
Overriding fast_osc c-extension FastOsc::decode_single_message, falling back to pure Ruby version
/tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ffi-1.11.3/lib/ffi/platform.rb:61: warning: already initialized constant FFI::Platform::CPU
/tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ffi-1.11.3/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library 'libaubio.4.2.2.dylib': libaubio.4.2.2.dylib: cannot open shared object file: No such file or directory. (LoadError)
Could not open library 'libaubio.4.2.2.dylib.so': libaubio.4.2.2.dylib.so: cannot open shared object file: No such file or directory.
Could not open library 'libaubio.so.1': libaubio.so.1: cannot open shared object file: No such file or directory.
Could not open library 'libaubio.so.5': libaubio.so.5: cannot open shared object file: No such file or directory.
Could not open library 'aubio1.dll': aubio1.dll: cannot open shared object file: No such file or directory.
Could not open library 'libaubio1.dll.so': libaubio1.dll.so: cannot open shared object file: No such file or directory
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ffi-1.11.3/lib/ffi/library.rb:99:in `map'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ffi-1.11.3/lib/ffi/library.rb:99:in `ffi_lib'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ruby-aubio-prerelease/lib/aubio/api.rb:9:in `<module:Api>'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ruby-aubio-prerelease/lib/aubio/api.rb:4:in `<module:Aubio>'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ruby-aubio-prerelease/lib/aubio/api.rb:3:in `<top (required)>'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ruby-aubio-prerelease/lib/aubio.rb:2:in `require_relative'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/vendor/ruby-aubio-prerelease/lib/aubio.rb:2:in `<top (required)>'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/lib/sonicpi/samplebuffer.rb:17:in `<top (required)>'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/lib/sonicpi/studio.rb:16:in `require_relative'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/server/ruby/lib/sonicpi/studio.rb:16:in `<top (required)>'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/gui/qt/build/../../../../app/server/ruby/bin/sonic-pi-server.rb:20:in `require_relative'
	from /tmp/.mount_sonic-X7JYwH/bundles/bundle/var/build/sonic-pi/app/gui/qt/build/../../../../app/server/ruby/bin/sonic-pi-server.rb:20:in `<main>'

Thanks for the feedback everyone! I’m glad to hear that it’s working, at least for some people.

  • This definitely needs a README.
  • OSC support is implemented in Erlang, and I haven’t tried packaging Erlang with this app image yet. It’s another large and complex dependency, and I’m actually considering reimplementing OSC support in C++ directly in the Sonic Pi UI process to avoid that dependency.
  • I used Sonic Pi 3.20 for the first build, but later versions could easily be built with the same build script.
  • I did miss libaubio, and probably several other libraries. The Exodus tool that I used to help with the packaging does a great job of finding all the direct library dependencies and packaging them all up together, but it doesn’t automatically detect libraries loaded at runtime. Ruby library loading in general has been difficult, and via strace I see on my own machine that it’s still trying to load system libraries rather than the ones packaged with the app image. I think I may need to build Ruby from source and point it at a custom path for libraries to keep it from trying to load system Ruby libraries.

I’ll keep chipping away at these as I’m able, but now that there’s a mostly working baseline I’d love to have others contribute at https://github.com/spencerschumann/sonic-pi-appimage. Eventually I’m hoping that this build process can be merged in to Sonic Pi’s codebase rather than being maintained as a separate project.

1 Like

Great to see progress here, thanks for all your hard work!

One thing to note is that whilst you might be able to re-implement the well-timed Erlang OSC scheduler in C++, it’s not something I’d consider merging in to the main repo. The Erlang side of things is a very important part of the future of Sonic PI and is starting to grow rapidly at this stage.

Good to know on the plans for Erlang. I like the language, but it just seemed like a big dependency to pull in for the small amount of Erlang code currently in Sonic Pi. Knowing that there are plans to expand it, I’ll take a look at adding it to the app image.

Given Sonic Pi’s Ruby heritage, Elixir would be an interesting choice for the Erlang side of things…

But the next thing on my todo list for this is to fix up the Ruby dependencies. I think for those of us that were able to get the appimage running it was mostly through accidentally falling through to the system install of Ruby and just happening to have most of the packages it uses already installed. I’m going to try using github.com/rbenv/ruby-build to build and install Ruby from source to a non-default location, with the added benefit of being able to use any Ruby version rather than just whatever’s already packaged.