Using Qjackctl with jackd and pulseaudio
Posted: Sat Dec 13, 2014 8:00 am
Pulseaudio becomes to be the standard audio server in nearly all distributions,
so it wasn’t sufficient to ignore/avoid it any longer.
It turns out, that pulseaudio indeed could work smooth together with jackd.
In my case, I’ve two different scenarios, in which way I wont to use my system.
First one is, using jackd for serious audio work, pushing pulseaudio out of the way.
That's easy, pulseaudio provide a tool for that. pasuspender
The syntax is easy, just start jackd with
pasuspender -- jackd -your -commandline -options -for -jack -here
or, for simplify, just put pasuspender -- in the qjackctl settings window,
in the server path field before jackd. You can save this settings in qjackctl.
Now, when you start jackd with qjackctl, pulseaudio will suspend as long jackd runs,
when you stop jackd, pulseaudio will re-span. Easy, eh?
Next scenario, make pulse a client of jackd. This way, applications witch usually
use pulseaudio for audio out-in-put works as well.
This requires some configuration hints for the pulse daemon.
Pulseaudio comes therefor with the user-space tools pacmd/pactl.
To make pulseaudio a jack-client, we need to load the pulseaudio jack modules.
pacmd load-module module-jack-sink channels=2
pacmd load-module module-jack-source channels=2
and make them to the default in-out-puts for pulse.
pacmd set-default-sink jack_out
pacmd set-default-source jack_in
eh voila, pulseaudio is now a jack-client. When you stop jackd,
you must set back pulseaudio to use the previous used alsa ports.
Sounds as easy as the scenario before, but it isn’t. Often, this
will fail to work proper, timing is the key here.
I’ve found a script here:
https://github.com/ldo/pajackconnect
which try to solve the second scenario, but it don’t do it proper enough.
It didn’t take care about the previous used ports, witch is important
when you have multiple soundcards installed, and often it fail to
make pulse a proper jack client, as well it didn’t allow the first scenario.
So I forked it and rework it for my use-case. (pull-request is send)
https://github.com/brummer10/pajackconnect
This script is intend to be added in the qjackctl option window,
Usage: in QjackCtl’s Settings window, in the “Options” tab, enter
the command
./path/to/pajackconnect start &
in the field labeled “Execute script after Startup”, and put
./path/to/pajackconnect stop &
in the field labeled “Execute script on Shutdown”.
./path/to/pajackconnect reset &
in the field labeled “Execute script after Shutdown”.
Add a new setting in the QjackCtl’s Settings window first tab, and remove
the pasuspender command from the server prefix. Save it.
Now, when you start jackd with qjackctl, pulseaudio will become a proper
jack-client, and when you stop jackd, pulseaudio will switch back to the
previous used alsa-ports.
Now, you can, when ever you start jackd with qjackctl, select from the
Settings window, if you would use pulseaudio as a jack-client,
or if you would suspend pulseaudio for the session.
regards
hermann
so it wasn’t sufficient to ignore/avoid it any longer.
It turns out, that pulseaudio indeed could work smooth together with jackd.
In my case, I’ve two different scenarios, in which way I wont to use my system.
First one is, using jackd for serious audio work, pushing pulseaudio out of the way.
That's easy, pulseaudio provide a tool for that. pasuspender
The syntax is easy, just start jackd with
pasuspender -- jackd -your -commandline -options -for -jack -here
or, for simplify, just put pasuspender -- in the qjackctl settings window,
in the server path field before jackd. You can save this settings in qjackctl.
Now, when you start jackd with qjackctl, pulseaudio will suspend as long jackd runs,
when you stop jackd, pulseaudio will re-span. Easy, eh?
Next scenario, make pulse a client of jackd. This way, applications witch usually
use pulseaudio for audio out-in-put works as well.
This requires some configuration hints for the pulse daemon.
Pulseaudio comes therefor with the user-space tools pacmd/pactl.
To make pulseaudio a jack-client, we need to load the pulseaudio jack modules.
pacmd load-module module-jack-sink channels=2
pacmd load-module module-jack-source channels=2
and make them to the default in-out-puts for pulse.
pacmd set-default-sink jack_out
pacmd set-default-source jack_in
eh voila, pulseaudio is now a jack-client. When you stop jackd,
you must set back pulseaudio to use the previous used alsa ports.
Sounds as easy as the scenario before, but it isn’t. Often, this
will fail to work proper, timing is the key here.
I’ve found a script here:
https://github.com/ldo/pajackconnect
which try to solve the second scenario, but it don’t do it proper enough.
It didn’t take care about the previous used ports, witch is important
when you have multiple soundcards installed, and often it fail to
make pulse a proper jack client, as well it didn’t allow the first scenario.
So I forked it and rework it for my use-case. (pull-request is send)
https://github.com/brummer10/pajackconnect
This script is intend to be added in the qjackctl option window,
Usage: in QjackCtl’s Settings window, in the “Options” tab, enter
the command
./path/to/pajackconnect start &
in the field labeled “Execute script after Startup”, and put
./path/to/pajackconnect stop &
in the field labeled “Execute script on Shutdown”.
./path/to/pajackconnect reset &
in the field labeled “Execute script after Shutdown”.
Add a new setting in the QjackCtl’s Settings window first tab, and remove
the pasuspender command from the server prefix. Save it.
Now, when you start jackd with qjackctl, pulseaudio will become a proper
jack-client, and when you stop jackd, pulseaudio will switch back to the
previous used alsa-ports.
Now, you can, when ever you start jackd with qjackctl, select from the
Settings window, if you would use pulseaudio as a jack-client,
or if you would suspend pulseaudio for the session.
regards
hermann