Jack and PA-Jack modules autoloading

I hope you don’t mind me posting this here as my quandary is really more Jack related than Ardour related, but as they have the same developer, plus I have noticed the behaviour exists when starting Ardour, I felt it may be the best place for an answer from the horse’s mouth, as it were.

I was sure in the past I had Jack setup through qjackctl to only load the PA-Jack sink/source modules when an actual PA application loads and thus calls them. I’m on a new laptop so it could be configuration differences but I’ve noticed many programs, including Ardour are causing the above mentioned modules to load when started up.

Settings in qjackctl relating to PA are using the server prefix “pasuspsender – /usr/bin/jackd” and have “killall pulseaudio” as the script run at startup.

Which this VLC and Audacity, both of which have a third party plugin for Jack which I use, open up and play without starting up the PA-Jack modules. Ardour, Audacity and Mixxx all trigger the loading of these modules for some reason though.

Is this something wrong with my setup? Something I’m going to have to live with? Or an error in one or more of the programs?

I’m running Ubuntu Studio 16.04 but have the KXStudio repos and others enabled so please ask if exact software versions of any software will assist in any way.

Make sure you have jackdbus installed. It should automatically connect your pulse modules to jack when jackdbus is running. At least on Fedora it works like that. AFAIK there is no way to set up PulseAudio through qjackctl. Regarding Ardour, I have never seen it try to communicate with PulseAudio directly, or even attempt to load pulse modules for that matter. You normally have two options with Ardour, alsa or jack. However, if jackdbus is running and you are using the alsa module in ardour, it will attempt to connect ardour via alsa back into pulseaudio.

BTW, correct me if wrong, but I think Paul is no longer developing jack.

The problem is the PA-Jack modules get loaded when they shouldn’t do as the program which I have opened is configured to use the Jack server. PA programs load and use the PA-Jack modules perfectly as expected, but when running Jack enabled application exclusively I would like to not have the processor overhead having these module loaded introduces to the system (on my old system it made the difference between glitch free playback at 16ms or 8ms, which makes a lot of difference if doing anything with live MIDI/performance as it can’t be corrected like recording can.)

Last night I got a niggle bell ringing at the back of my mine to get it working and the autospawning properly prevented (but still loading with a PA reliant program) I think I had to remove a executable bit from one of the PA files but I could be mistaken and not managed to find any answers pointing me in that direction…

Maybe Paul has stopped development of Jack I’m not sure, but still an immensely knowledgeable person and as I see this behaviour when starting up Ardour I thought it may be something he would have insight to.

There are a few things you might try. Number one, you can disable the pulseaudio autospawn in one of the pa config files (not sure which one and can’t look right now) and totally get rid of PA altogether. Also, you might just comment out in that config file the reference to the PA-Jack module. And yes, Paul would certainly know the answer to this when he has the time to reply.

kazakore: The simplest way to not have the PA->jackdbus bridge running is to use jackd instead of jackdbus. pasuspender and pulseaudio -k should not be needed if your OS/jackd/pulseaudio are less than about 4 or 5 years old. in qjackctl on the setup dialog in the Misc tab there is a setting called: enable D-bus interface… hmm there are two now. So depending on how old your version of qjackctl is… there will be either one dbus option on the tab or two. If there is only one, enabled will start the pa-jack bridge at next jackd start, disabled will not. if there are two, I think the one called enable jack D-bus interface is the one to turn off and on. Basically these settings just determine if qjackctl uses jackd or jackdbus to run jack. If you wish to leave qjackctl as is, you can disable the pa-jack bridge on the fly with: pactl unload-module module-jackdbus-detect
You can reload it on the fly with: pactl load-module module-jackdbus-detect

Thanks Len, useful ideas to look into, although it mean remembering to start the Jack session differently when I’m definitely not going to want PA to be available (eg if I’m actually performing live and want max stability and min overhead/latency.) I had hoped, as certain apps seem to not trigger the loading of the PA modules, there would be something more simple. It seem just scanning what PA modules are loaded with “pactl list short modules” causes the PA-Jack modules to get loaded when they weren’t before, thus I guess it’s something to do with initialising the system and scanning what audio options may be available when the program opens. Possibly having it so that as long as the selected audio setup is detected at program startup no other audio options are scanned until the Preferences are opened might prevent this. But not really something I would want to try and get the software devs to try and change in all affected software I use…

So thanks for your pointers and I’ll experiment and see how I can get it working best for me that way :slight_smile:

@kazakore You should be able to change the audio device in those apps using PA to jack. You may need to install the jack module for each of those programs depending on your dist. I know I have configured both VLC and Audacity to use jack instead of alsa/pulseaudio. Uncheck jackdbus in qjackctl and your problem should be solved. Everything should map through jack and ignore PA altogether.

As I said I use Jack with VLC and Audacity already, those are the programs which Do Not open the PA-Jack modules upload opening and playing media, whereas progressions audio programs such as Ardour, Audacious and Mixxx all Do load the PA-Jack modules on program open. If anything I would have expected the opposite to what I have found but that’s life.

Rhythmbox and Firefox (html5/Flash) playback both do not have any form of Jack support as far as I have managed to find. All programs that do have a Jack plugin I try and install and use it already…

They are not USING PulseAudio but despite the fact they are configure to used Jack they still load the PA-Jack modules upon program load. I don’t know how much more clearly I can say that simple fact…

rhythmbox has it because gstreamer has it, as do all other apps that use gstreamer as their media-streaming library. Firefox/Mozilla has it via a recently accepted patch from Damien Zammit.

I never managed to get gstreamer via Jack to work. I have the gstreamer bad plugins installed, which should include this but when I open up gconf-editor, as per the instructions on the guide pack on the Jack website, there is nothing under System (or anywhere else at all for that matter) for gstreamer.

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

Well I can play a tone via gstreamer, I can see it open the module on Jack (seem the example code is mono so connects left only) but this confirms it’s all installed and should work.
$ gst-launch-1.0 audiotestsrc ! jackaudiosink

This guide has a screenshot that confirms the settings in gconf-editor should be in the most obvious place I expected from the other guide. They are just not showing there at all though!

Although with just very quick testing I’ve found you get some rather nasty audio effects if you have it and another stream producing sound at the same time, but on the positive side I didn’t see even a marginal jump in the CPU meter on it getting loaded…