As of April 2013, L2Ork is proudly supporting Raspberry Pi (RPi) platform. Below are instructions on how to get started, including how to remotely connect to RPi and share its own internet connection with RPi, as well as a collection of external resources with additional information. While it is perfectly reasonable to use RPi independently by connecting it to its own screen, mouse, keyboard, and the internet connection, the instructions below focus on an alternative setup where RPi is running headless. This means we will connect to it via the laptop, use laptop’s keyboard, touchpad, screen, and speakers, and share laptop’s internet connection to allow RPi access to the internet.
- One laptop with Ubuntu 12.04 (or newer) with at least 1 USB, 1 ethernet port, and a working wireless internet connection
- One Raspberry Pi (RPi) with USB power cable and an ethernet (network) cable
- One SD Card with PdPi Raspbian image installed on it
For additional information on how to install the said Raspbian pdpi image that includes a number of audio-related optimizations, visit pdpi website.
Step 1: Connecting to RPi
First we will connect to RPi, so that we can reconfigure its settings to better fit our specific needs as well as set up internet connection sharing to install software libraries necessary to run Pd-L2Ork, and eventually Pd-L2Ork itself.
1. On your laptop configure a new ethernet network connection with a static IP of 192.168.1.1.
Next, open Network Connections window by clicking on “Edit Connections…” option in the Network Manager top-panel menu.
In the Network Connections menu select “Wired” tab and then click on “Add.”
Create a temporary RPi network connection with appropriate settings.
2. Connect the RPi and laptop using ethernet cable and power it via USB port
Before connecting anything, make sure that your SD Card is properly seated inside RPi.
Using a generic ethernet cable connect the RPi ethernet port with that of your laptop. Similarly, using a micro-USB cable connect RPi micro-USB port with one of laptop’s USB ports to provide power the RPi.
Once RPi is powered and booted you should get all 4 LEDs lighting up (one red, two green, and one yellow, with ACT LED occasionally blinking, showing CPU activity). Please note booting RPi may take up to a minute.
3. Open Terminal application and login remotely into RPi using secure shell (ssh)
Copy following code and paste it into terminal:
When prompted, enter RPi password which is 3.14159 and you should be in.
Step 2: Getting RPi on the Internet
Given that we also may need to download additional packages from the internet, we will also set up our laptop used to connect to RPi to share its internet connection with RPi. To do this we will need to reconfigure RPi static IP and set up a special ethernet connection between the laptop/computer and RPi.
1. Change RPi’s static IP address to 10.42.0.10
We will alter RPi’s static IP address, so that once we set up the internet connection sharing on the laptop (which by default in Ubuntu generates 10.42.0.* IP address range), RPi remains within the same domain as the laptop. To do this, we need to edit the /etc/network/interfaces file. Since this is a system file, we will do so by using sudo command that will temporarily grant us administrative privileges:
sudo gedit /etc/network/interfaces
You may be asked sudo password, which should be the same as the RPi login password. Now find the following line:
iface eth0 inet static
and change contents below it as follows:
netmask 255.255.255.0 address 10.42.0.10 gateway 10.42.0.1
Then, save the file. Once you’ve edited and saved the file, reboot RPi for the network changes to be updated.
sudo shutdown -r now
Upon rebooting, you will not be able to connect to RPi and this ok because RPi now has a new IP address that places it into a different domain. Next, we will reconfigure our laptop’s network connection so that it can once again connect to RPi.
Key commands used in this step are sudo, gedit, and reboot. sudo command grants us “superuser” or administrator access, so that we can alter important system files as well as order computer remotely to reboot. gedit command starts Gnome text editor.
2. Set up new internet sharing connection
Navigate back to the Network Manager top-panel menu and reenable wireless connection. Wait for the wireless connection to come back online and then click on “Edit Connections…”
In the Network Connections window, delete the old temporary connection we created earlier–we won’t be needing this anymore. Then, add a new connection by clicking on the “Add” button.
We’ll call the new connection “Raspberry Pi Shared Connection.” On the IPv4 tab make sure to select “Shared to other computers” method. Also make sure that the “Require IPv4 adressing for this connection to complete” option. Save the newly created connection.
In the Network Manager top-panel menu click on the Raspberry Pi Shared Connection and wait a few moments for the Network Manager to indicate that the connection is active. We are now ready to reconnect to RPi using its new IP address.
Step 3: Install Pd-L2Ork and supporting libraries
By now we should be ready to begin installing software. First we will connect to RPi’s newfound IP address.
1. Connect to RPi via ssh using new IP address
Once again, we use ssh, but this time we also pass it a “-Y” flag that allows us to view applications started on RPi on laptop’s screen.
ssh -Y email@example.com
When prompted, enter password which is 3.14159.
Doing so will allow you to access RPi and configure it properly for use with Pd-L2Ork.
2. Make sure you are able to access the internet
ping -c 3 l2ork.music.vt.edu
If everyting works ok, you should be getting output similar to the one below:
…icmp_req=2 ttl=48 time=124 ms
We need to make sure your internet connection is working before instructing RPi to install new software, as the software will have to be retrieved from the internet. ping command sends a simple signal to a desired address and lets us know how long it has taken for a signal to return to us. This is arguably the simplest way one can make sure that they are indeed connected to the internet. Otherwise, the signal will never reach our desired destination resulting in an error.
3. Install Pd-L2Ork
Following is a direct link to the latest version of Pd-L2Ork for the RPi platform.
Download Pd-L2Ork for arm6 (deprecated, unsupported) or arm7 (latest) architecture
Given we cannot open a browser (yet) on RPi, the easiest way to download the said package onto RPi via ssh is to copy the link above and use the following command:
This will download the latest version of the Pd-L2Ork deb installer. Once the download is complete, type following command to install Pd-L2Ork:
sudo dpkg -i pd-l2ork*deb
NB: If you happen to have more than one Pd-L2Ork deb installer in the folder where you downloaded the latest deb installer, you may need to substitute full file name instead of pd-l2ork*deb.
Once the install has completed, you will likely encounter errors because pd-l2ork depends on other external libraries to function. Not to worry, unless you’ve already installed such libraries for other reasons (which is unlikely), this error is expected. To correct this problem, simply type:
sudo apt-get update && sudo apt-get -f install
Once the libraries are downloaded and installed, the computer will automatically configure Pd-L2Ork and report that everything has indeed completed successfully. You should be now ready to run Pd-L2Ork on RPi. To test this, type:
You should get the output similar to the one below:
Pd-L2Ork version 2.16.0 (20211208-rev.d3e3d542) compiled 15:36:14 Dec 8 2021
At this point you should be ready to run Pd-L2Ork because in step 3 we connected to RPi using “-Y” flag that allows us to view applications we wish to run on RPi on laptop’s screen. Therefore typing pd-l2ork in the terminal will open it on the RPi and yet be visible on our laptop’s screen. While this may suffice for power users, beginners may prefer to access RPi’s entire desktop. In the optional Step 4 below we will investigate setting up remote X session so that we can do exactly that.
This step will install Pd-L2Ork software on RPi which is likely the main reason you’re following this tutorial ;-) dpkg command is a tool designed to install software packaged in deb format. You can think of it as a manual version of the apt-get tool that also calculates dependencies.
Step 4 (optional): Configure Remote Desktop Access to RPi
Accessing entire RPi desktop has some additional benefits, one of which includes ability to use Pd-L2Ork icons in the Application Menu that pre-configure various settings at startup and ensure that Pd-L2Ork requires minimal set up from a user.
1. Exit the current ssh session with RPi
Type following command in the terminal:
We will temporarily disconnect from RPi so that we can configure laptop to display RPi’s desktop.
2. Set up secondary X server on the laptop and reconnect to RPi
Start a new X server session.
sudo xinit -- :1
Once you press CTRL+ALT+F7, you will be back on your primary X (Desktop) session. Press CTRL+z to stop the newly created X session and then type following to background it, so that you can continue using the terminal (otherwise terminal will be unresponsive until the new X session is exited):
We need to start a new X session that will display RPi’s desktop over network. Doing so will render terminal unresponsive until the current running program is backgrounded. For this reason we use bg (background) command to free-up the terminal so that we can issue other commands to it. Apart from sudo we used before, other commands used in this step include xinit that is responsible for starting a new X session. We pass it a –:1 flag to instruct computer to start a new session on a new virtual display, so that it does not clash with the existing laptop X session.
3. Set up secondary X server on the laptop and reconnect to RPi
Press CTRL+ALT+F7 to return to your primary desktop (X) session. Once there, type the following command in the terminal:
DISPLAY=:1 ssh -Y firstname.lastname@example.org lxsession
When prompted, enter RPi password (3.14159) and once logged in, leave the terminal open for as long as you wish to maintain remote connection with RPi and switch to the new X (Desktop) session by pressing CTRL+ALT+F8. You should be greeted with the following desktop image. And voila! You are now using RPi through your laptop. With the exception of audio output, everything you do on RPi will be presented to you using laptop resources. You can always listen to audio output by plugging in speakers or headphones directly into RPi audio out connector.
Once again, we use the “-Y” flag, followed by the lxsession command that broadcasts entire RPi desktop onto the laptop’s X session we created earlier and that can be accessed by pressing CTRL+ALT+F8.
Step 5: Run Pd-L2Ork (including K12 module) on RPi
1. Start Pd-L2Ork
1. Type command into the terminal (this is the only option for those who have skipped step 4)
For regular Pd-L2Ork type:
pd-l2ork -noautopatch -rt -audiobuf 50 -inchannels 2 -outchannels 2 -alsamidi -mididev 0
For K12 module type:
pd-l2ork -k12 -noautopatch -rt -audiobuf 50 -inchannels 2 -outchannels 2 -alsamidi -mididev 0
Note the only difference between the two is the “-k12” flag we use when we wish to run K12 version of Pd-L2Ork.
sudo pd-l2ork -noautopatch -rt -audiobuf 50 -inchannels 2 -outchannels 2 -alsamidi -mididev 0
If you are connecting to RPi via network you may also need to use the -E flag like so:
sudo -E pd-l2ork -noautopatch -rt -audiobuf 50 -inchannels 2 -outchannels 2 -alsamidi -mididev 0
For K12 module simply add the -k12 flag right after the pd-l2ork command.
2. Navigate into RPi’s application menu and click on the Pd-L2Ork application icon (possible only if using remote X session described in optional step 4)
Open Application Menu by clicking on the icon in the bottom left corner of the screen, then navigate to Sound & Video sub-menu, and select the appropriate Pd-L2Ork version.
Either way, upon starting Pd-L2Ork, you will be presented with the main Pd-L2Ork window:
When starting pd-l2ork remotely without the access to X session, we don’t have the ability to visually navigate application menus, so we use terminal to directly invoke command that would be otherwise invoked by clicking on the application icon.
2. Configure Pd-L2Ork’s Audio Setup
Before we can use Pd-L2Ork we need to adjust default audio settings. This is a one-time step and once the settings have been adjusted you won’t have to go through this step again.
In the main window menu click on “Media” and then “ALSA” which stands for Advanced Linux Sound Architecture, or the backbone of audio support in Linux.
A new window titled “Audio Settings” will pop up. In it, make sure to adjust delay (msec) to 50, and make sure that bcm2835 ALSA (hardware) audio device is selected both for input and output. Once done, click on “Apply,” and then “Save All Settings.” This will ensure that next time you start Pd-L2Ork, the chosen settings will be remembered. Once you’ve saved the settings, you can close the Audio Settings window.
The default settings Pd-L2Ork ships with are quite ambitious–this is what we use in L2Ork on a daily basis, but our systems have been specially tailored for this purpose. With 5ms default internal latency, systems without a custom real-time kernel (the core of an operating system) and adequate CPU power simply cannot cope with. Since RPi is considered a relatively low-powered device in terms of raw CPU power, we need to adjust settings to that they better match RPi’s capabilities.
3. Test audio
Connect speakers or headphones to RPi’s 1/8″ (headphone) jack.
In the main window,click on “Media” menu, and then on “Test Audio and MIDI” option.
A patch window will pop up, populated with various objects and controls. In the top left corner, below the “TEST TONES” heading click on the box that says 60 (this will bring the audio levels up) and check if you can hear the audio coming out of the headphones/speakers connected to RPi.
Before we can begin using Pd-L2Ork, we need to ensure that the audio is indeed properly configured.
Congratulations, you’re now ready to use Pd-L2Ork on RPi!
Compiling Pd-L2Ork for RPi from Source
To compile Pd-L2Ork on RPi you can follow the instructions for compiling Pd-L2Ork found on the main Software page with one notable exception: after retrieving the source from the git, use -R flag for the autocompile script, like so:
Once the install deb package has been generated, simply follow the install instructions provided above. Hope this helps!
Questions? Look us up on the L2Ork-Dev public mailing list.