It is certainly possible to work with the Elk development kit board directly using the standard tools available through the terminal, e.g. SSH to connect, and SCP to transfer files to and from the board. There are however several applications available which you could use to significantly streamline the process.

We present suggestions on how to efficiently edit files on the board using desktop GUI applications, and to remotely manage the Elk board’s filesystem.

Do note that while we for simplicity specifically refer to our Elk Pi board, the advice applies also to our boards for other platforms.

Using IDE’s to remotely write code, and manage the filesystem on the Elk Pi

We detail using Visual Studio Code, and Eclipse, as they are available on all main desktop platforms: Linux, Windows, and OS X.

But of course many platform-specific IDE’s also provide similar functionality, not the least Microsoft’s Visual Studio 2019.

Visual Studio Code

The Microsoft Visual Studio Code (VS Code) IDE is available across Linux, Windows and OS X platforms. It has support for all the programming languages, formats and tools that we currently use with Elk, and our examples: C++, Python, CMake, Git, json, and Bash shell-scripts.

VS Code is lightweight as a core application, but can be expanded using a wide variety of very-well integrated extensions.

Using the “Remote – SSH” extension, VS Code significantly streamlines transferring files to the Raspberry Pi, editing them in-place, and even executing the software on the device.

Start by connecting to your Elk Pi over SSH using the terminal (see your getting started guide if not). Next you can follow the instructions in the official Remote – SSH guide, to connect To the Elk Ri using VS Code. Just skip the sections about setting up a virtual machine, since you will be connecting to your Elk Pi’s Linux.

Manage the Elk Pi file system remotely from VS Code

The default SSH connection location upon first connection is /home/mind. With the “File->Open Folder” command, you can choose to connect to any other folder (e.g. /tmp, or /udata), or the filesystem root for that matter.


Figure 1: VS Code, connected over SSH to an Elk Pi’s filesystem root, with the sushi.log file open.

While connecting to the filesystem root is handy, you have to make a few settings to enable watching for file changes on a large workspace – see here for those settings, if you are running VS Code on Linux Desktop

With that in place though, you can for example have the /tmp/sushi.log file permanently open, and only a mouse-click away from seeing the latest changes after the most recent Sushi execution (see Figure 1 above).

Moreover, there is an integrated terminal window local to the Elk Pi, which you may find convenient to use, instead of maintaining an SSH connection in a separate terminal window.

Extremely conveniently, you can transfer files and folders between your Desktop computer and the Elk Pi, simply by dragging and dropping to and from the file tree to the left!

Already with this, creating .json configuration files for Sushi and Sensei, and editing Bash scripts to start and stop your processes, becomes nearly as straightforward as if you were working locally on the desktop.

Eclipse

The Eclipse IDE will likely be familiar to very many of you. Its set of features is very extensive, and it can be further be greatly extended with plugins, so it is no surprise that it too provides the ability of working on a remote device.

How you Install Eclipse varies depending on your platform. For Linux, if you want to install the latest version, the Ubuntu Software Center will not be of help. The version it hosts is a year behind at the time of writing. But the steps needed for installing the latest release are well documented elsewhere, for example on itsfoss.com.

The default installation of Eclipse does not come with the plugin needed, the “Remote System Explorer” (RSE). To install it, launch Eclipse, and follow the below menu command sequence:

  1. Help -> Install New Software…
  2. Work with… dropdown. Select 2019-12 (or your current Eclipse version). Expand the “General Purpose tools” category.
  3. Select “Remote System Explorer End-User Runtime” and “Remote System Explorer User Actions”.
  4. Click through to accept licenses, install, and restart Eclipse.

Using the Remote System Explorer:

  1. Click Window -> Show View -> Other…
  2. Select Remote Systems -> Remote Systems.  A new tab appears in the Eclipse IDE.
  3. Select the “+” button on the left of the button bar for this tab “Define a connection to a remote system”.
  4. System type: Linux – Press NEXT. 
  5. Host name: <ELK PI IP>. Press NEXT.
  6. Files: ssh.files. Press Next.
  7. Processes: processes.shell.linux. Press Next.
  8. shells: ssh.shells. Press Finish.
  9. Now you have an entry in the RSE tab for your system.
  10. Right click it, select “Connect”.

A tree will appear, where you can explore the Elk Pi’s filesystem, directly edit files, and using which you can directly transfer files using drag and drop.


Figure 2: Eclipse, connected over SSH using the Remote System Explorer plugin to an Elk RPi’s filesystem, with a Sushi configuration file open for editing.

Finally you can also launch an SSH terminal directly within Eclipse. Just press ctrl-shift-alt-T, choose terminal: SSH Terminal. Host: the IP of your Elk Pi.  User: mind, PW: elk.

SSHFS: Locally Mounting a Remote File System

If you work with an IDE that unlike VS Code and Eclipse, does not connect directly, you can use SSHFS to mount the Elk Pi’s filesystem to yours, allowing you to thus treat all files and folders on the Elk Pi as local ones.

You need to install SSHFS on your platform ($ sudo apt-get install sshfs on Linux). Given that, it is as simple as creating a folder for the purpose on your computer:

$ mkdir ~/elk_pi_fs

And then typing:

$ sshfs mind@<ELK PI IP>:/ ~/elk_pi_fs

Given that, you can navigate to that folder through your operating systems file manager, and work as if the files were local – e.g. Figure 3, with the Elk Pi’s filesystem navigable through Ubuntu’s Nautilus.


Figure 3: The Elk Pi Examples folder, accessed using Ubuntu’s Nautilus, by means of mounting the Elk Pi’s filesystem to the local one using SSHFS.

The above command mounts the Elk Pi filesystem temporarily, but you can also mount it permanently – see here for further instructions on working with SSHFS on Ubuntu.

Debugging Audio and MIDI connections to Elk Pi

When you are getting started, the first thing you want to ensure is that you get audio in and out of the device, and that the MIDI messages you send are indeed received.

While in the vast majority of cases, the steps in our getting started guide will work straight out of the box, sometimes you may not have a USB MIDI device available, or your MIDI may not work correctly. 

In the former case, to ensure that audio is at least working, you can run an example configuration which does not depend on MIDI input. The one below instead produces notes for the synth to play, using Sushi’s built-in arpeggiator plugin:

$sushi -r -c ~/config_files/mda-vst2-configs/config_play_arp_mda_synth.json

In the latter case, to debug MIDI messages you can do the following:

Launch $ aseqdump &, and connect your MIDI device to it with aconnect. You should see incoming MIDI messages printed to the terminal, see Figure 4.

Figure 4: Using aseqdump to print received MIDI messages to the terminal.

You can as a next step launch Sushi with the --log-level=debug flag. This will turn on MIDI logging among the other things. If MIDI messages are received properly, you should see lines like this in Sushi’s log file (/tmp/sushi.log on your Elk Pi):

[2019-12-14 15:39:56.501] [debug] [alsamidi] Received midi message: [e0 0 3e 0] timestamp: 358983144

Creating Bash-scripts for starting and stopping processes

Finally, a simple, very useful tip directed to users unfamiliar with Linux.

When your setup grows in complexity, you no longer need to launch only Sushi with a configuration file, but also Sensei, your own Python Glue program, and aconnect, for each execution. And when done, of course terminate all these.

Repeatedly entering all the commands gets tedious, but you can simply create two Bash scripts for starting and stopping – see the two examples below:

$ ./run_instrument:

#!/bin/bash
# Start Instrument

sushi -r -c ~/instrument/elk_sushi_conf.json &

sensei -f ~/instrument/elk_sensei_conf.json &

~/instrument/elk_instrument_glue_app &

# waiting for everything to have initialized before connecting
sleep 3

aconnect 16 128

$ ./stop_instrument:

#!/bin/bash
# Stop Instrument

pkill ~/instrument/elk_instrument_glue_app

pkill sensei

pkill sushi

Closing Words

Already, the above make working with the Elk Pi much easier, and for now we will pause here on the topic. However, stay in tune for our future post on further tips: for example, on remote debugging of your Python and C++ code.

Thank you for reading! 

For any questions on Elk, or anything else, please visit our forum, or write to us at tech@elk.audio.

(Many thanks for the input of Elk Pi user Rick Cohen of Qubiq audio, for sharing his notes with us on working with Eclipse)

Related All Tech

13 May
The Audio Programmer Virtual Meetup

29 April
Elk Audio OS ♥ HiFiBerry

17 April
Introducing the BLACKBOARD

06 April
Raspberry Pi 4 support

21 January
Sensei - Standing in the way of control

20 January
CCRMA Workshop

27 November
ADC19 - Talk

30 August
Elk on the I.MX8M Mini!

16 August
std::algorithm for audio, part II

16 August
Controlling plug-ins in Elk, part II:

20 June
std::algorithm for audio, part I

04 June
Controlling plug-ins in Elk, part I:

24 May
Using CMake for compiling XMOS code

27 March
Audio Latency demystified, part II:

15 March
Audio Latency demystified, part 1

01 March
Discover the DAW inside Elk

26 January
ELK Development Boards Overview

23 January
How Elk works