HOWTO: jackd on Pine64
#1
Music 
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.
(Edit: strangely enough this error still occurs even if you are using a more recent image with jackd2 v1.9.11.)
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.
Code:
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:
Code:
git clone git://github.com/jackaudio/jack2

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

.

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

.

The compilation of jackd2 requires a few dependencies which we need to install:
Code:
sudo apt install libasound2-dev libexpat1-dev

Now we can start the compilation preparation by giving the following command:
Code:
./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 
Code:
--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
Code:
./waf

You will see now a lot of text scrolling over your screen. If everything went fine, you will get a 
Code:
'build' finished successfully

 message. We are now going to install this version of jackd by running:

Code:
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:
Code:
sudo rm /usr/lib/aarch64-linux-gnu/libjack*

Now test jackd by running
Code:
jackd -d alsa

Jack should now output something similar to
Code:
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
Code:
sudo usermod -a -G audio [username]

where you change 
Code:
[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 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
Code:
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.

This guide is also posted (and updated) on github: https://gist.github.com/mauritslamers/32...bc19cb5e75
#2
Thanks for writing this up and posting to the forum!
Come have a chat in the Pine IRC channel >>


Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming languages support under PINE64 baryluk 6 13,427 09-23-2020, 11:46 PM
Last Post: Phillip Bell
  Manjaro arm on pine64+ roel 2 6,531 10-19-2019, 05:13 AM
Last Post: roel
  Howto run Linux with resolution other than 1080p longsleep 28 71,312 06-13-2019, 01:53 AM
Last Post: Nilda
  Volumio for PINE64 Released mikelangeloz 11 26,539 03-22-2019, 09:25 AM
Last Post: llungster
  I2S Audio patches for Pine64+ uploaded to GitHub ramstadt 1 4,438 01-19-2019, 11:31 AM
Last Post: ramstadt
  Pine64: Minimal SDL config Max11 3 6,653 01-04-2019, 03:47 PM
Last Post: Max11
  Fedora 27 on Pine64 gregjo 18 38,542 01-02-2019, 10:42 PM
Last Post: heatfanjohn
  Official build procedure of ayufan pine64 r.tanaka 0 3,364 08-21-2018, 10:54 PM
Last Post: r.tanaka
  DKMS on kernel 3.10.107-pine64 obrienmd 5 9,642 06-21-2018, 05:45 PM
Last Post: evilbunny
  Gentoo for pine64 - longsleep kernel incoherent 0 3,893 12-09-2017, 08:14 AM
Last Post: incoherent

Forum Jump:


Users browsing this thread: 1 Guest(s)