Skip to content

Instantly share code, notes, and snippets.

@mauritslamers
Last active April 19, 2018 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauritslamers/327dcd01a5110d340b9519bc19cb5e75 to your computer and use it in GitHub Desktop.
Save mauritslamers/327dcd01a5110d340b9519bc19cb5e75 to your computer and use it in GitHub Desktop.
Howto get JackD running on a Pine64 board

As many people have found, the default jackd version that comes with the Pine64 Ubuntu image (which is version 1.9.10) will crash as soon as you start it with a bus error and a message in the kernel log about an aligment problem.

In later versions of jackd this has been solved, but as there is no package, you're currently required to compile it by hand. This is not as difficult as it might sound, but it requires some tinkering in the terminal. Also: make sure that your pine64 board has enough power. If you use a 2.0A rated power supply, the board might crash in the middle of the process (as has happened to me). This tutorial assumes you are working with either the Ubuntu Basic Image, or the Ubuntu Mate image. If you are running a different image, the same process will apply, but you might need to adjust some actions.

The first thing we need to do is to install the old version of jack, because we need to make the system think that jackd is installed.

sudo apt install jackd2

During the installation it will ask whether jackd should be run with real time priority. Answer yes on this question. Then install all the audio applications you're going to use, such as for example Ardour.

Then we are going to clone the latest version of jackd from github. Open a terminal by selecting Applications > System Tools > Mate Terminal or something equivalent:

git clone git://github.com/jackaudio/jack2

If you get a message about unknown command, install git first by running sudo apt install git.

Then go into the jack2 directory as created by the git command: cd jack2.

The compilation of jackd2 requires a few dependencies which we need to install:

sudo apt install libasound2-dev libexpat1-dev

Now we can start the compilation preparation by giving the following command:

./waf configure --alsa=yes --classic --prefix=/usr

Depending on what kind of hardware you are going to use, you might need to add additional parameters to this line. Check for more info by adding --help to the end of the line above. (In case I missed some dependency here, the process will warn you about it).

We start the compilation by running

./waf

You will see now a lot of text scrolling over your screen. If everything went fine, you will get a 'build' finished successfully message. We are now going to install this version of jackd by running:

sudo ./waf install

Sadly we are not entirely there yet. The source install puts certain files in a different spot compared to the standard packages, so in order to make jack not use the original files, we delete the files from the original package:

sudo rm /usr/lib/aarch64-linux-gnu/libjack*

Now test jackd by running

jackd -d alsa

Jack should now output something similar to

pine64@pine64:~/jack2$ jackd -d alsa
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback

If it replies with a message about permissions, it is possible that your user is not part of the audio group. Add yourself by doing

sudo usermod -a -G audio [username]

where you change [username] for your user.

If you do see the bit of text above, you now successfully installed jackd2 and it is running. You can now stop this process by pressing Ctrl-C.

From here you can use qjackctl or any other tool to start jackd.

A few considerations

When using jack on the Pine64, be aware that how smaller the buffer size is the more work it has to do. The latency will go down, but keep in mind that as soon as the CPU-temperature goes over 80 degrees Celsius, the CPU will be throttled. The performance of the board is pretty good. I had 32 mono tracks smoothly playing in Ardour with a few plugins on the side and the temperature didn't rise above 57 degrees C.

I managed to get jackd running in realtime with buffer sizes from 128 frames at a sample rate of 44100hz. Don't go lower as it will keep jackdbus hanging rather badly. I didn't test the upper limit well, but 192000Hz samplerate at 4096 frames buffer also seems to run fine.

I also tried with LMMS and found that a sample rate of 192k didn't work very nicely with synthesis, as that is rather heavy on the CPU. You will notice quickly enough if you hear too many sample drops.

Troubleshooting

I had a very weird problem where only one channel was playing of the two I saw playing in Ardour. I then used the builtin audio test of Mate and had the same problem there. It turns out that in my case the left channel was muted. I was able to solve this by using

alsamixer

It turned out that the DACL Mixer AIF1DAOL port (which was the left stereo channel) was muted. It is a bit unclear why this happened, but if you happen to run into the same kind of problem, this is where you should be able to solve it.

Credits

Many thanks to Xalius for his help in getting to the bottom of this.

@ritsch
Copy link

ritsch commented Apr 19, 2018

Thanks, great work, also worked on an Olimex A64
(didnt find the obsolete libjack* libs),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment