‹ TiBook restoration - Offline Laptop Impulse Train in SuperCollider ›

Building SuperCollider for piCore Linux 2

2021-07-27 14:32 supercollider

This is an updated version of /f0blog/building-supercollider-for-picore-linux/ which demonstrates how to build, package and install SuperCollider and sc3-plugins for piCore - the Raspberry Pi port of TinyCoreLinux.

The instructions here below are for piCore12.0 (32-bit) while the old post was for piCore-9.0.3. The main difference between the two is that we no longer need to build jack2 ourselves. jack and jack-dev are now included in the piCore repository. This version also compiles SuperCollider with avahi support.

introduction

piCore has many advantages over the common Raspbian system. It will boot a lot faster, is extremely light-weight and is easy to customise. And because the whole system always resides in RAM, SD card wear is minimal.

Its immutable-by-default design means one can unplug the power to the Raspberry Pi without performing and waiting for a proper shutdown nor risking corrupting the SD card. It also allows one to experiment without being afraid of messing up. A simple reboot will take the system back to a known state. For changes to be persistent, one must deliberately write them to the SD card (using the command filetool.sh -b).

Some drawbacks are that piCore is more advanced to install and configure and that much common Linux software is missing from the built-in package manager (one will have to compile it oneself - hence this guide).

requirements

preparation

On the laptop, open a terminal and run the following commands:

ping 192.168.1.255  #first broadcast ping (stop with ctrl+c)
arp -a  #figure out which IP address the RPi has (here 192.168.1.13)
ssh tc@192.168.1.13  #default password: piCore

sudo fdisk -u /dev/mmcblk0  #then press the following keys in order to delete and recreate partition2
 p  #note start of partition2 - StartLBA - usually 139264
 d
 2
 n
 p
 2
 139264  #enter start of partition2 from above
 <RET>  #type return to accept suggestion
 w  #write

filetool.sh -b
sudo reboot

ssh tc@192.168.1.13  #pass: piCore

sudo resize2fs /dev/mmcblk0p2  #resize partition2

install dependencies

Assuming piCore is now installed and partition2 resized like above...

#download and install build dependencies
cd /tmp
tce-load -wil cmake compiletc squashfs-tools libudev-dev libsndfile-dev readline-dev libsamplerate-dev avahi-dev jack-dev git
wget http://tinycorelinux.net/9.x/armv6/tcz/fftw-dev.tcz  #from old repository
tce-load -il fftw-dev
sudo /usr/sbin/cache-clear

building SuperCollider

Assuming all dependencies above are installed...

#download and compile SuperCollider
cd /tmp
git clone --branch main --single-branch --recurse-submodules https://github.com/supercollider/supercollider.git
cd supercollider
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE="Release" -DBUILD_TESTING=OFF -DSUPERNOVA=OFF -DNATIVE=ON -DSC_IDE=OFF -DNO_X11=ON -DSC_QT=OFF -DSC_ED=OFF -DSC_EL=OFF -DSC_VIM=ON -DINSTALL_HELP=OFF -DSC_ABLETON_LINK=OFF -DCMAKE_C_FLAGS="-lncursesw" -DCMAKE_CXX_FLAGS="-lncursesw" -DCURSES_LIBRARY="/usr/local/lib/libncursesw.so" -DCURSES_INCLUDE_PATH="/usr/local/lib/" ..
make
sudo make install
cat install_manifest.txt | grep -v "/usr/local/include/\|/usr/local/share/pixmaps/\|/usr/local/share/mime/" > /tmp/sc.list
make clean

#create the SuperCollider tcz extension package
cd /tmp
tar -T /tmp/sc.list -czvf /tmp/sc.tar.gz
mkdir /tmp/pkg && cd /tmp/pkg
tar -xf /tmp/sc.tar.gz
cd ..
mksquashfs pkg/ supercollider.tcz
sudo mv supercollider.tcz ~
rm -rf /tmp/pkg
tce-load -i ~/supercollider.tcz
sclang -h  #just to check that it is working

On the laptop, open another terminal window and download the resulting compressed SuperCollider package:

scp tc@192.168.1.13:supercollider.tcz ~/Downloads  #pass: piCore

building sc3-plugins

Assuming SuperCollider is installed like above...

#download and compile sc3-plugins
cd /tmp
git clone --branch main --single-branch --recursive https://github.com/supercollider/sc3-plugins.git
cd sc3-plugins
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE="Release" -DSUPERNOVA=OFF -DNATIVE=ON -DSC_PATH=../../supercollider/ ..
sudo /usr/sbin/cache-clear
make
sudo make install
cat install_manifest.txt | grep -v "/HelpSource\|.html\|/Help" > /tmp/scplugs.list
make clean

#create the sc3-plugins tcz extension package
cd /tmp
tar -T /tmp/scplugs.list -czvf /tmp/scplugs.tar.gz --exclude=*/HelpSource --exclude=*.html --exclude=*/Help
mkdir /tmp/pkg && cd /tmp/pkg
tar -xf /tmp/scplugs.tar.gz
cd ..
mksquashfs pkg/ sc3-plugins.tcz
sudo mv sc3-plugins.tcz ~
rm -rf /tmp/pkg

On the laptop, open another terminal window and download the resulting compressed sc3-plugins package:

scp tc@192.168.1.13:sc3-plugins.tcz ~/Downloads  #pass: piCore

Now that the two tcz packages are created and saved to the laptop, we can erase the SD card and start afresh. (It is possible to continue working with the same piCore install, but unused build dependencies would waste some space).

Install instructions

(for future installs you can skip all of the above and start here assuming you have kept the .tcz packages)

On the laptop, open a terminal and run the following commands:

ping 192.168.1.255  #first broadcast ping (stop with ctrl+c)
arp -a  #figure out which IP address the RPi has (here 192.168.1.13)
ssh-keygen -R 192.168.1.13  #resets the ssh keys to be able to log in again
ssh tc@192.168.1.13  #default password: piCore

sudo fdisk -u /dev/mmcblk0  #then press the following keys in order to delete and recreate partition2
 p  #note start of partition2 - StartLBA - usually 139264
 d
 2
 n
 p
 2
 139264  #enter start of partition2 from above
 <RET>  #type return to accept suggestion
 w  #write

filetool.sh -b
sudo reboot

ssh tc@192.168.1.13  #pass: piCore

sudo resize2fs /dev/mmcblk0p2  #resize partition2

#install dependencies
tce-load -wi alsa alsa-utils jack libsamplerate libavahi libudev readline git nano

On the laptop, open another terminal window and upload the compressed packages:

cd ~/Downloads
scp supercollider.tcz sc3-plugins.tcz tc@192.168.1.13:

Back on the Raspberry Pi...

cd ~
mv supercollider.tcz sc3-plugins.tcz /mnt/mmcblk0p2/tce/optional/
echo -e "supercollider.tcz\nsc3-plugins.tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
echo -e "\nsudo /usr/local/sbin/alsactl -f /home/tc/mysound.state restore" >> /opt/bootlocal.sh

#autostart - optional
nano autostart.sh  #add the following lines
  #!/bin/sh
  jackd -P75 -p16 -dalsa -dhw:0 -r44100 -p1024 -n3 &
  sclang /home/tc/mycode.scd
chmod +x autostart.sh
echo -e "/home/tc/autostart.sh &" >> /opt/bootlocal.sh

nano mycode.scd  #add the following lines
  s.waitForBoot{
    {SinOsc.ar([400, 404], 0, 0.5)}.play;
  };

nano /opt/bootlocal.sh  #change from ondemand to performance in line 10
  echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

#IMPORTANT - make the changes permanent
filetool.sh -b

sudo reboot

The piCore system should now have SuperCollider installed and (optionally) start at boot.

volume

To adjust the volume log in and run the following commands...

alsamixer  #set volume with arrow keys, ESC to exit
alsactl -f /home/tc/mysound.state store  #save in custom alsa settings file
filetool.sh -b  #make permanent

notes


‹ TiBook restoration - Offline Laptop Impulse Train in SuperCollider ›