jackd: Raspberry Pi and Audioinjector

Moderator: flatmax

Post Reply
flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

jackd: Raspberry Pi and Audioinjector

Post by flatmax » Tue Sep 20, 2016 5:21 am

Setup jackd to work with the Audio Injector soundcard for the Raspberry Pi.

Jackd1 does not work with the Raspberry Pi (it gives BUS ERROR which is probably due to an old padding issue).
Jackd2 does work with the Raspberry Pi. We will install that and setup the mmap interface to work with the audio injector sound card.

Firstly uninstall jackd1 : sudo apt-get purge jackd1
Now install jackd2 : sudo apt-get install jackd2
Edit your /boot/config.txt to include : dtoverlay=i2s-mmap

When you install the jackd2 package, it will prompt you whether you want to use real time settings. Say yes here as this will up the scheduling priority of jackd audio related processes. I find jackd has great performance and no xruns.

Reboot to have the i2s-mmap devicetree overlay setup and whala ... jackd will be working :
jackd -d alsa -r 96000

If you hear pops and see xruns, probably a good idea to enable real time permissions, to do that run the following and answer yes :
sudo dpkg-reconfigure jackd2

Matt
http://www.audioinjector.net/#!/rpi-hat
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: jackd: Raspberry Pi and Audioinjector

Post by abonam » Fri Jun 30, 2017 12:46 pm

Hello,

I am trying to establish a master-slave connection using jackd to stream realtime audio.
My configuration is Ubuntu (master) and RPI3 (slave).
Linux kernel is 4.10.0-19-generic and I have latest Jessie on RPI3.
Launched qjackctl and created a setup for jackd, saved on ~/.jackdrc.

Code: Select all

marco@Dell-E6410:~$ cat ~/.jackdrc
/usr/local/bin/jackd -S -P80 -t2000 -dalsa -r44100 -p1024 -n3 -D -Chw:MID,0 -Phw:MID,0
marco@Dell-E6410:~$ 
I tried to change the Frames/Period to 256, 512, 1024, 2048, 4096 and the Period/Buffer to 2, 3, 4.
I can start the server via qjackctl, then I issue the command

Code: Select all

marco@Dell-E6410:~$ jack_load netmanager
netmanager is running.
client name = netmanager
The messages windows does not show any errors or Xrun messages.
Then I start the Client on the RPI3 side

Code: Select all

pi@raspberrypi$jackd -R -S -d net
pi@raspberrypi$
At this point I can see the raspberry on the connect window as shown in https://drive.google.com/open?id=0B3rsi ... kZpN2hCeFk and I can connect the master:capture to the slave:playback using the connect interface.
The messages windows is flooded with error messages as follows:

Code: Select all

Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackEngine::XRun: client = marco-Latitude-E7440 was not finished, state = Triggered
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackEngine::XRun: client = marco-Latitude-E7440 was not finished, state = Triggered
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackEngine::XRun: client = marco-Latitude-E7440 was not finished, state = Triggered
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Thu Jun 29 18:26:48 2017: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error 
(...)
19:14:13.915 XRUN callback (4 skipped).
Thu Jun 29 19:14:13 2017: NetMaster : missing last data packet from 'raspberrypi'
Thu Jun 29 19:14:13 2017: NetMaster : missing last data packet from 'raspberrypi'
Thu Jun 29 19:14:14 2017: NetMaster : missing last data packet from 'raspberrypi'
Thu Jun 29 19:14:14 2017: NetMaster : missing last data packet from 'raspberrypi'
(...)
Audio does not play on the slave side, and after few seconds the client connection drops.

I tried already similar configuration using:
MacPro (master) - RPI3 (client)
and
RPI3 (naster) - RPI3 (client)
with identical results.

So far I was not able to get any audio at all on the client side.

Any help to address this issue will be really appreciated.
Thank you in advance for your time!!
-Andrea

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: jackd: Raspberry Pi and Audioinjector

Post by flatmax » Tue Jul 04, 2017 12:06 am

OK - so seems that you understand how to hook up master/slave jackd systems.
Here is an example of the way I set up, which is very similar, on the master :

Code: Select all

jackd -d alsa -d hw:SL1 -o 2 -i 2
jack_load netmanager
On the slave :

Code: Select all

jackd -r -d net -a 192.168.0.20 -C2 -P2
I specify the number of input and output ports I want to run.

Sometimes I also use the -M to increase this value to make sure larger network transmissions are happening ... you could even tune that to match your period size ... hmmm. For example, sometimes I do many channels over the network and use the MTU tuning capacity to improve results. I wonder if that would help your situation at all ?

It would be good to have a stable system before you do further debugging. Can you try to get rid of the xruns and process errors ?

thanks
Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: jackd: Raspberry Pi and Audioinjector

Post by abonam » Thu Jul 13, 2017 9:40 am

Hello,

sorry for the late reply and thank you for your hint.
I would LOVE to get rid of those (damn) Xruns :-)

Will keep you posted!
Cheers,
Andrea

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: jackd: Raspberry Pi and Audioinjector

Post by abonam » Fri Jul 14, 2017 1:06 pm

Ok, I just noticed the jackd and wi-fi are not good friends :-(
As long as master and slave are connected through wired Ethernet, I do not see the Xruns.
When I try to use wi-fi on the slave, then the Xruns happens.

I searched on the net and found out there are several problem to address when using jack and wi-fi. I am using wap_supplicant to manage wi-fi and I read that one of the problem could be the process keeps querying for wi-fi networks. So I stopped the query and forced a static IP address in my subnet.
Even with the jack priority set to 90 I see the Xruns flooding as soon as the slave gets connected.

Any pointer to address this issue?

Thank you in advance!

Andrea

flatmax
Posts: 609
Joined: Sat Jul 23, 2016 11:39 pm

Re: jackd: Raspberry Pi and Audioinjector

Post by flatmax » Tue Jul 18, 2017 12:45 pm

Did you try to turn up your MTU ?
Increase the latency by increasing the jackd period size ?

Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

abonam
Posts: 20
Joined: Sat May 13, 2017 7:21 am

Re: jackd: Raspberry Pi and Audioinjector

Post by abonam » Wed Jul 19, 2017 11:59 am

Hello,

once again, thank you for your answer.

I tried to change the Frames/Period to 256, 512, 1024, 2048, 4096 and the Period/Buffer to 2, 3, 4.
I also tried to increase the MTU up to 24000 (I don't even know if it makes sense) using multiples of 1500 (like 3000, 6000 and so on).

The result is still the same: flood of errors like

Code: Select all

JackAudioDriver::ProcessGraphAsyncMaster: Process error
and slave losing connectivity after few seconds. I am start thinking I have to surrender ....but I would like to give jack over wi-fi another chance.
If you have another idea I will be happy to try.

One question: is there any debug I can turn on to discover more information about this process error?
Does it help looking into /var/log/syslog ?

Thank you in advance for your help.

Cheers,
Andrea

robiwan
Posts: 59
Joined: Wed Jul 05, 2017 1:18 am

Re: jackd: Raspberry Pi and Audioinjector

Post by robiwan » Sat Jan 27, 2018 7:50 pm

I'm trying to setup jackd running with the Octocard. I've setup the I2S mmap for /boot/config, but I just can't get the damn jackd server to start:

Code: Select all

jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 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"
Jack: JackPosixThread::StartImp : create non RT thread
Jack: JackPosixThread::ThreadHandler : start
Jack: JackDriver::Open capture_driver_name = hw:0
Jack: JackDriver::Open playback_driver_name = hw:0
Jack: Check protocol client = 8 server = 8
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackPosixSemaphore::Allocate name = jack_sem.0_default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Jack: JackGraphManager::SetBufferSize size = 1024
Jack: JackConnectionManager::DirectConnect first: ref1 = 0 ref2 = 0
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackDriver::SetupDriverSync driver sem in flush mode
Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Audio device hw:0 cannot be acquired...
Jack: ~JackDriver
Cannot initialize driver
Jack: no message buffer overruns
Jack: JackPosixThread::Stop
Jack: JackPosixThread::ThreadHandler : exit
JackServer::Open failed with -1
Jack: Succeeded in unlocking 82278944 byte memory area
Jack: JackShmMem::delete size = 0 index = 0
Jack: ~JackDriver
Jack: Succeeded in unlocking 1232 byte memory area
Jack: JackShmMem::delete size = 0 index = 1
Jack: Cleaning up shared memory
Jack: Cleaning up files
Jack: Unregistering server `default'
Failed to open server
Ideas ?

Update: export DISPLAY=:0 helper and also setting dbus params with export $(dbus-launch), but now I cannot start the server:

# sudo dbus-launch jack_control start
--- start
DBus exception: org.jackaudio.Error.Generic: Failed to open server

And in jackdbus.log:

Sun Jan 28 11:25:41 2018: Controller activated. Version 1.9.11 (unknown) built on Tue Mar 28 04:44:11 2017
Sun Jan 28 11:25:41 2018: Loading settings from "/root/.config/jack/conf.xml" using expat_2.2.0 ...
Sun Jan 28 11:25:41 2018: ERROR: failed to stat "/root/.config/jack/conf.xml", error is 2 (No such file or directory)
Sun Jan 28 11:25:41 2018: ERROR: open() failed to open conf filename.
Sun Jan 28 11:25:41 2018: Listening for D-Bus messages
Sun Jan 28 11:25:41 2018: Starting jack server...
Sun Jan 28 11:25:41 2018: ERROR: `default' server already active
Sun Jan 28 11:25:41 2018: ERROR: Failed to open server

This all is very confusing...

robiwan
Posts: 59
Joined: Wed Jul 05, 2017 1:18 am

Re: jackd: Raspberry Pi and Audioinjector

Post by robiwan » Tue Jan 30, 2018 11:52 pm

Ok, I built jack2 from source without dbus, and with the RT patched kernel from https://github.com/guysoft/RealtimePi (thanks guysoft) I can now run the Octocard with frames down to 32 (haven't tried lower) without a hitch. Very happy :)

start_jack:

Code: Select all

#!/bin/sh
# Running 64 frames mostly to hold CPU usage down (with 64 frames its about 10%)
sudo jackd -P70 -d alsa -r 48000 -p 64 &
sudo jack_wait --wait --timeout 10
sudo jack_connect system:capture_1 system:playback_1
sudo jack_connect system:capture_2 system:playback_2

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests