Headless Samplerbox raspberry pi 4

B
Brady posted Oct 24 '21, 22:59:

After having spent two days I finally figured out how to run Samplerbox headless on the raspberry pi 4, while being able to connect to it from your mac (what I have) or PC to add instruments and samples. You have to connect it to a monitor/tv because wpa_supplicant.conf will not work until you change the localisation settings. Here is what I did, it's not very specific just my notes so if you have any questions let me know, it's mostly in bullet point form:

download the lite version from googling raspberrypi, going to software and downloading raspberrypiOS lite
use Etcher or other software to mount iso from raspberrypiOS lite

Add text file named ssh to boot on sd card, make sure to delete .txt at end of file

Create wpa_supplicant.conf in textedit or new text document, make sure to go to format>plain text
make sure it looks like this

ctrl_interface=/var/run/wpa_supplicant
update_config=1
country=us

network={
ssid="Wi-Fi network"
psk="your password"
}

Insert SD card into raspberry pi and plug it into a tv or monitor
login: pi
password:raspberry
follow prompt to change password
enter the command:
sudo raspi-config
set localization options, system settings,display options (especially hostname); make sure to change boot options in system settings to autologin text
go to system settings and change the WLAN connection to your network and put in password
enter the following commands and wait for them to finish:
sudo apt update
sudo apt full-upgrade
sudo reboot

login through ssh:
On a mac go to terminal, enter ssh [email protected] (or whatever you changed your password to)
enter password

Now we have to check what soundcard our device is using. I use the headphone jack. To find what card you would like to use use the command:
aplay -l

find the card number you would like to use, it is most likely 0 or 1.
configure card through the following command:
sudo nano /usr/share/alsa/alsa.conf
scroll down until you see defaults.ctl.card 0 and defaults.pcm card 0
change the 0 to 1 or whatever card you are using. You may not even have to use it.

Test that audio is working by using the following command:
alsamixer

you can turn it up or down with the arrow keys on your keyboard or by scrolling with your mouse.

now it's time to test if your audio is working by entering the following command:
speaker-test -c2 -twav

you should hear sound through the left and right speakers. Use control+c to stop it.

*note if the speakers are not working try installing pulseaudio through the command
sudo apt-get install pulseaudio

*if it is still not working restart from the beginning. It is a pain, but it is much easier than trying to troubleshoot literally anything that could go wrong. You will have to change the trusted hosts on your mac or other computer if the ssh does not work and gives you a warning. If given the warning, in the terminal simply input the command:
/home/myuser/.ssh/known_hosts:24 changing the myuser for your username and known_hosts to what you see in the warning.

Now it's time for the entire reason we are here which is to install SamplerBox.

*go to samplerbox github for instructions or use the following

input the following commands:
sudo apt-get update ; sudo apt-get -y install git python-dev python-pip python-numpy cython python-smbus portaudio19-dev libportaudio2 libffi-dev

sudo pip install rtmidi-python pyaudio cffi sounddevice

sudo pip install sounddevice

git clone #find the clone link on the samplerbox github#

cd SamplerBox ; sudo python setup.py build_ext –inplace

python samplerbox.py

sudo apt-get install what it says it needs. You will likely have to install several things. i.e. if it says something about rtmidi not being found, use the command sudo apt-get rtmidi etc.

keep using the following command till you have installed everything:
python samplerbox.py

once you see that it has worked, plug in midi controller and make sure you can hear sound. If not, you may have to restart the entire process. Don't worry, now that you've done it once it shouldn't take too long.

use command control+c to stop SamplerBox

now it's time to install netatalk to allow us to access our samplerbox without having to take out the sd card everytime so we can add instruments wirelessly and easily

use the commands:
sudo apt-get install netatalk
sudo nano /etc/netatalk/afp.conf

delete “;” before [Homes] and basedir regex. Change xxxx to home in basedir regex

make sure it shows up on mac. Go to Finder and it should show up under network devices. Here you can go to home>SamplerBox to see instruments and all the python scripts

if you would like, now is the perfect time to add samples to /home/Samplerbox (make sure to use definition.txt if necessary)
I made a nice rhodes sample for samplerbox using the legendary JRhodes .sf2 files without looping as it sounded better which I should be posting to this forum soon. It should be called 1 jrhodesfade or something similar and I will post the link to it in this thread.
*make sure samples are short or a segmentation error will appear

Now we need to make it so the raspberry pi can boot without a monitor or ssh. Use the command:
sudo nano /boot/config.txt

uncomment (delete the "#" before the text) framebuffer_width and framebuffer_height

control+x then y then return

command:
sudo nano /home/pi/.bashrc

at the end of the script after the last fi type:

echo Running at boot
cd SamplerBox
sleep 3
python samplerbox.py

sudo reboot to see if it works

If you followed this guide then your Raspberry Pi 4 should be working without any screens or any need to ssh into it. If you have any questions I will try to answer them as this guide may not be specific enough. I find it very nice to be able to use without a monitor or ssh and still be able to add samples from my computer via netatalk. Hope this helps!

...

  (not published)
  I want to post as guest
 

Post