Using Qjackctl with jackd and pulseaudio

Post fully complete "how to" guides and tutorials here. This is a great place to get feedback on stuff you might put in the wiki.

Moderators: MattKingUSA, khz

tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: Using Qjackctl with jackd and pulseaudio

Post by tramp »

I've updated the repository, it contain now the systemd.service file and the debian folder with the needed post install and rm scripts to enable / remove the systemd service, to make it work after suspend.
I've also added instructions for how to make it work on other distributions then debian/ubuntu.

https://github.com/brummer10/pajackconnect
On the road again.
User avatar
sysrqer
Established Member
Posts: 2519
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 319 times
Been thanked: 148 times
Contact:

Re: Using Qjackctl with jackd and pulseaudio

Post by sysrqer »

Thank you for these instructions and scripts. I've been having a problem with cadence and pulseaudio which I can't solve (detailed here - viewtopic.php?f=47&t=16769, maybe I just didn't explain the problem clearly enough) so I decided to try qjackctl. Sure enough, it works perfectly for me so I suppose I'll have to ditch cadence.

One thing though, it seems an xrun is created when I suspend/resume. I don't care that this happens but the qjackctl icon goes red. Is there a way to stop it from turning red?
User avatar
GMaq
Established Member
Posts: 2774
Joined: Fri Sep 25, 2009 1:42 pm
Has thanked: 520 times
Been thanked: 555 times

Re: Using Qjackctl with jackd and pulseaudio

Post by GMaq »

Hi,

In case anyone is interested I've done a guide for AV Linux (which comes without PulseAudio) but it should generally apply and be useful to most Debian Ubuntu and Mint people in setting up PulseAudio and Qjackctl, In the guide I've also created and linked some pajackconnect Deb packages (created from tramps GIT repo).

many thanks to tramp for his useful modifications to this script!

As a side note the soon to be released AV Linux 2017 will come with this routing pre-installed and working OOTB.

For anyone interested guide is here: http://bandshed.net/forum/index.php?topic=3937.0
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: Using Qjackctl with jackd and pulseaudio

Post by tramp »

sysrqer wrote:One thing though, it seems an xrun is created when I suspend/resume. I don't care that this happens but the qjackctl icon goes red. Is there a way to stop it from turning red?
This Xrun happens when jackd restart after resume, it's independent from pulse. You could reset the counter (remove the red colour) by middle click on the Icon or the widget.
GMaq wrote:many thanks to tramp for his useful modifications to this script!
You are welcome. :)
On the road again.
NilsOF
Established Member
Posts: 7
Joined: Fri Apr 28, 2017 6:56 pm

Re: Using Qjackctl with jackd and pulseaudio

Post by NilsOF »

This thread saved me from hours of fumbling!

The only ting missing is the .deb build command magic spell:

Code: Select all

dpkg-buildpackage -rfakeroot -uc -b
If the github readme could be updated with that, it would be nice.
I have done this for years and I still had to search for the "spell" :-D
tramp
Established Member
Posts: 2335
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 454 times

Re: Using Qjackctl with jackd and pulseaudio

Post by tramp »

NilsOF wrote:This thread saved me from hours of fumbling!
Always good to hear that it is useful. :D
NilsOF wrote:The only ting missing is the .deb build command magic spell.
If the github readme could be updated with that, it would be nice.
Yea, done.
On the road again.
Shadow_7
Established Member
Posts: 175
Joined: Tue Jun 08, 2010 3:35 pm

Re: Using Qjackctl with jackd and pulseaudio

Post by Shadow_7 »

I've gotten a bit exotic with multiple machines. On the machine with the good soundcard connected to the good speakers I have a pulse over jack setup. Mostly the same as it has been for a good while, except jackd2 now (jackdbus). Setup as follows based on #3 of the guide.

http://jackaudio.org/faq/pulseaudio_and_jack.html

https://github.com/jackaudio/jackaudio. ... ulseOnJack

It is quirky for non-tech types. I have to run a script after start up, then restart pulseaudio.

FILE: myjackcontrol.sh

Code: Select all

#!/bin/bash

#jack_control start
jack_control ds alsa
jack_control eps realtime false
jack_control dps device hw:1
jack_control dps rate 48000
jack_control dps rate 48000
jack_control dps nperiods 3
jack_control dps period 512
So...
$ ./myjackcontrol.sh
$ jack_control start
$ pulseaudio --kill
$ pulseaudio --start

What I do every time I start X. And it works. Relative to debian stable (jessie), I have the following modifications (additions) from the defaults.

FILE: /etc/pulse/client.conf

Code: Select all

autospawn = no
FILE: /etc/pulse/default.pa

Code: Select all

load-module module-native-protocol-tcp auth-ip-acl=192.168.2.0/24;127.0.0.1
set-default-sink jack_out
set-default-source jack_in
FILE; /etc/pulse/daemon.conf

Code: Select all

default-sample-format = s16le
default-sample-rate = 48000
realtime-scheduling = no
exit-idle-time = -1
On the machine with the pulse over jack setup, with the exception of the user who starts pulseaudio. I use multiple users, one for networking, one for web browsing, one for media creation, and on and on. It helps me keep individual bash_history, browser logins, or just makes it easier to see which user (process) is hogging all the drive space. $(xhost local:) if you want to do that and share the X session.

FILE: $HOME/.config/pulse/client.conf

Code: Select all

default-server = 127.0.0.1
For all users.

FILE: $HOME/.asoundrc

Code: Select all

ctl.pulse { type pulse fallback sysdefault }
pcm.pulse { type pulse fallback sysdefault }
ctl.!default { type pulse fallback sysdefault }
pcm.!default { type pulse fallback sysdefault }
For the remote machine using pulseaudio over the network, change the 127.0.0.1 (aka localhost) to the ip of the pulseaudio machine 192.168.2.1 in my case.

FILE: $HOME/.config/pulse/client.conf

Code: Select all

default-server = 192.168.2.1
Which is minimal effort for all the client users / machines. A neat trick I recently learned is using alsa's loopback device to run jack on the remote machine and then send that to pulse on the server machine. Or to your local machines soundcard (lower latency) while still having a remote pulse setup.

$ sudo modprobe -r snd-aloop
$ sudo modprobe snd-aloop pcm_substreams=2 enable=1

start jackd using the loopback device

$ jackd -r -m -t 10000 -d alsa -d hw:Loopback -P -o 2 -r 44100 -S -s -m

send jackd to pulse on the "other" computer.

$ alsaloop -C hw:Loopback,1,0 -P pulse

send jackd to the local soundcard.

$ alsa_in -j hw:Loopback -d hw:1
$ alsa_out -j hw:Loopback -d hw:1

And then do the usual jackd stuff. As a side note when starting rosegarden the alsaloop process dies, just restart it after rosegarden starts. And sometimes the sound routing fails but jackd and everything is still active and appearing to work. Just restart it all again to recover with actual sound. Most of my machines are low specifications so YMMV.

$ fluidsynth -a jack -g 1.5 -j -l -m alsa_seq -K 0 /usr/share/sounds/sf2/FluidR3_GM.sf2
$ vkeybd --octave 8 --channel 0 --device alsa
$ qjackctl

Note that I'm doing that with jack1 on the remote (local) to me machine and pulse over jack2 on the host machine. And I can have the local soundcard and the pulse host outputting sound at the same time. Each layer does add latency, so midi notes have an audible echo with alsa_out and alsaloop at the same time, probably close to 30ms if I were to measure it. The one advantage of a route like this is that the host machine does all the heavy lifting of running pulseaudio over jackd, plus other stuff like a 30 band EQ from the calfjackhost plugins. With all that processing happening on the host machine. So when you're local machine gets under load, the audio remains relatively unaffected. And you can get a couple more fps in games on the local machine. Another caveat is that you need to keep the system clocks relatively in sync.

$ sudo ntpdate pool.ntp.org

If you're not running a ntpd that does that on the regular.
Post Reply