sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.83k stars 922 forks source link

Sonic Pi 3.0 linux debian/ubuntu/mint build #1752

Closed GooDump closed 6 years ago

GooDump commented 7 years ago

Hi

I'm not sure this is the right place for my question, please (re)move if needed.

I started enjoying Sonic Pi on my laptop, which is running linux mint 17.3. Sonic-Pi 2.10 works perfectly (thank you, great software for learning about audio and programming!).

I have a midi input device and would like to try using it with sonic pi. However, I have no experience whatsoever with building packages from source, so I seem to be unable to get 3.0 installed. Will there be pre-build packages available?

rbnpi commented 7 years ago

It is unlikely that there will be built versions of Sonic Pi 3 form Linux, largely becuase there are many flavours of that OS, but also because Sam has very limited resources to develop it (at present he is seeking funding just to maintain the Raspbian, MacOS and Windows versions). Several people, myself included have built Sonic Pi from scratch on Linux (I have a working version on Ubuntu 17.04 However I have no experience of packaging it as a .deb so it is not available to others. When I started using Sonic Pi a few years ago I had no expeirience of building packages from source. However it is not as bad as it seems, and I would encourage you to experiment and have a go. There are others who have been on this journey and will be happy to help with questions.

To give you an idea, this is the process I carried out to build with Ubuntu 17.04 (and Ubuntu 17.10)

#Install SP3 on fresh Ubuntu 17.04 or 17.10
#(also much the same for Debian 9.1 and even Pi3 o Stretch))

#install following with sudo apt-get install (a couple may be there already)

git
libasound2-dev
libx11-dev
build-essential
cmake
libsndfile1
libsndfile1-dev
erlang-base
ruby
ruby-dev
qt5-qmake
libqwt-qt5-6
libqwt-qt5-dev
qttools5-dev-tools libqt5svg5-dev libqt5svg5 qtbase5-dev libqt5scintilla2-l10n libqt5scintilla2-dev libboost-dev supercollider-server sc3-plugins

#now install three downloads that need to be built (including Sonic PI!)
cd ~
git clone https://github.com/samaaron/sonic-pi.git
git clone https://git.aubio.org/aubio/aubio
git clone https://github.com/llloret/osmid.git

#set the sonic-pi "head" to the latest release
cd sonic-pi
git checkout 98914aaac061c1e7d6216b2a1065f49cb9733d9c  #latest commit for version 3.0.1
#build osmid binaries m2o and o2m
cd ~
cd osmid
mkdir build
cd build
cmake ..
make
cd ~  #we will install them later

#build and install aubio
cd aubio
./scripts/get_waf.sh
./waf configure
./waf build
sudo ./waf install
cd ~

#build two erlang .erl files to their equivalent .beam files
cd sonic-pi/app/server/erlang
erlc osc.erl
erlc pi_server.erl

#build the native ruby extensions to some Sonic Pi gems
cd ~
cd sonic-pi/app/server/bin
./compile-extensions.rb

#create the receiving folder and copy in the osmid binaries
cd ~
cd sonic-pi/app/server/native
mkdir -p linux/osmid
cd linux/osmid
cp ~/osmid/build/m2o ./
cp ~/osmid/build/o2m ./

#switch to the qt folder in Sonic Pi to build the docs and gui
cd ~/sonic-pi/app/gui/qt

../../server/bin/i18n-tool.rb -t
cp -f ruby_help.tmpl ruby_help.h
../../server/bin/qt-doc.rb -o ruby_help.h

export QT_SELECT=qt5 #select qt version to use
lrelease SonicPi.pro
qmake SonicPi.pro
make #this will take some time

#for jackd to work properly you must add YOUR username to the audio group
#substitute YOUR username for rbn below
sudo usermod -a -G audio rbn #to allow user to access jackd with rt privileges
#switch back to home folder and run Sonic Pi 3
cd ~
./sonic-pi/bin/sonic-pi
#(ctrl-C to quit)

#remaining problems. At present the two osmid binaries are not stopped on exit
#you must manually killall m2o and killall o2m before re-running.
#worth checking killall ruby and killall sonic-pi

#Sonic Pi will take the default sound card in slot 0.
#To use a different card start jackd with qjackctl (in the GUI) and configure it there.
#Also I found an error in scsynthexternal.rb
#Alter the scsynth connection commands in lines 386 and 387
#      `jack_connect SuperCollider:in_1 system_capture_1`
#      `jack_connect SuperCollider:in_2 system_capture_2`
#to read
#      `jack_connect SuperCollider:in_1 system:capture_1`
#      `jack_connect SuperCollider:in_2 system:capture_2`

Note I think there may be some changes if you use later source commits from Sonic PI, as this works with SuperCollider 3.7 and changes to scsynthexternal.rb imply SuperCollider 3.8 although it can be altered back. (use of the -B option when starting scsynth)

jhw commented 6 years ago

@rbnpi fantastic instructions, just the job. Many thanks. Have you tested midi ? Wondering if it's worth getting a midi-to-cv converter for my small (CV) synth

q2dg commented 6 years ago

Maybe these instructions could go to README to have a little more visibility...

samaaron commented 6 years ago

Closing this for now as we sadly don't have the resources to support generic linux at this stage.

If anybody would like to step up to help - either by offering support, updating the docs/installation scripts or maintaining a distro package please do let me know :-)