Jackdbus+A2J with Systemd startup

Official support for: bitwig.com
Post Reply New Topic
RELATED
PRODUCTS

Post

[
The following notes covers the setup of compliant jack-midi applications.

Bitwig needs the work around since it is non-jackmidi compliant and always wants to grab the alsamidi device:
a user cannot have a2jmidid loaded, and so if you are using systemd and have followed the provided instructions below, you can simply turn on and off a2j on the fly at any given moment when you need to use bitwig's ability to see and use midi devices properly.

-> systemctl --user disable dbus-org.gna.home.a2jmidid.service ; disables the on-boot for a2j
-> systemctl --user stop dbus-org.gna.home.a2jmidid.service ; shuts down the current running a2j service

For non-systemd/dbus things, ensure you are not loading "a2jmidid -e" (in its non-dbus form)

For users who use jackd --> Make sure ~/.jackdrc or your startup Qjactkctl settings does not use Jack-midi support. (this means jackd should not show up with "-X__" when it has loaded, and so this can be checked with pgrep jackd)

Enjoy, it's a long read and would help solve pretty much all your basic problems in getting jackdbus to work compliantly with pulseaudio and a2j.

]

I finally managed to get a working startup with systemd.

The setup:
1 alsa card
Load pulseaudio , followed by JackdBus+A2jDbus
(for those who are familiar there's "a2jmidid -e" which doesn't run in dbus mode)

The Pros:
- You can start JackdBus on and off without conflicting with Pulseaudio

The Cons:
- None! :stuck_out_tongue:

The problem with pulseaudio's module of jackdbus, is more often than not it doesn't do its job properly.

With a little tuning of a pre and after of running jackdbus, Systemd allows its unit files to include "ExecStartPre" << which allows one to do things before Jackd tries to grab the Alsa device.

My previous tweaks in getting this setup to work went around to using the "null sink" device with Pulseaudio.

However just recently I found a much better and assuring way that that wasn't enough for PulseAudio to letting go of the alsa card fully. Despite having module-jackdbus-detect always loaded with pulseaudio, sometimes its default sink (when manually starting jackdbus), would not switch to "jack_out" as the pulseaudio's jackdbus is designed to do. It maps and detects jackdbus, and immediately makes the sinks available(so pulseaudio's jackdbus module works half-way), but it sometimes fails to set the sink to jack_out.

My instruction below here, overcomes this problem, and instead uses direct pacmd commands in a dbus-org.jackaudio.service systemd unit file.

The nice thing about it is pulseaudio always gets its sink to jack_out.

The systemd unit file goes into ~/.config/systemd/user (if this path doesn't exist, the user needs to manually create it)
dbus-org.jackaudio.service
"
[Unit]
Description=JACK 2
After=pulseaudio.service
Requires=dbus.socket
Requires=pulseaudio.service

[Service]
Type=dbus
BusName=org.jackaudio.service

ExecStartPre=-/usr/bin/killall -9 jackdbus
ExecStartPre=-/bin/sleep 2
#ExecStartPre=-/usr/bin/pacmd load-module module-null-sink
#ExecStartPre=-/bin/sleep 2
ExecStartPre=-/usr/bin/pacmd set-default-sink null

ExecStartPre=-/usr/bin/pacmd unload-module module-jackdbus-detect
ExecStartPre=-/bin/sleep 1
ExecStartPre=-/usr/bin/pacmd unload-module module-jack-sink
ExecStartPre=-/usr/bin/pacmd unload-module module-jack-source
ExecStartPre=-/bin/sleep 2

ExecStartPre=-/usr/bin/pacmd suspend 1
ExecStartPre=-/bin/sleep 1

ExecStart=/usr/bin/jackdbus auto

ExecStartPost=-/bin/sleep 6
ExecStartPost=/usr/bin/jack_control ds alsa
ExecStartPost=/usr/bin/jack_control dps device hw:NVidia,7
ExecStartPost=/usr/bin/jack_control dps period 512
ExecStartPost=/usr/bin/jack_control dps nperiods 3
ExecStartPost=/usr/bin/jack_control dps rate 48000
ExecStartPost=/usr/bin/jack_control dps input-latency 32
ExecStartPost=/usr/bin/jack_control dps output-latency 32
ExecStartPost=/usr/bin/jack_control dps midi-driver none
ExecStartPost=/usr/bin/jack_control eps driver alsa
ExecStartPost=/usr/bin/jack_control eps realtime True
ExecStartPost=/usr/bin/jack_control eps realtime-priority 95
ExecStartPost=-/bin/sleep 1

ExecStartPost=-/usr/bin/jack_control start
ExecStartPost=-/bin/sleep 3

ExecStartPost=-/usr/bin/pacmd load-module module-jackdbus-detect channels=2 connect=true
ExecStartPost=-/bin/sleep 3
ExecStartPost=-/usr/bin/pacmd set-default-sink jack_out
ExecStartPost=-/usr/bin/pacmd suspend-sink jack_out 0

ExecStop=-/usr/bin/jack_control exit
ExecStopPost=-/bin/sleep 2
ExecStopPost=-/usr/bin/killall -9 jackdbus
ExecStopPost=-/bin/sleep 1

ExecStopPost=-/usr/bin/pacmd unload-module module-jackdbus-detect
ExecStopPost=-/bin/sleep 1
ExecStopPost=-/usr/bin/pacmd unload-module module-jack-sink
ExecStopPost=-/usr/bin/pacmd unload-module module-jack-source
ExecStopPost=-/bin/sleep 1
ExecStopPost=-/usr/bin/pacmd set-default-sink alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
ExecStopPost=-/bin/sleep 2
ExecStopPost=-/usr/bin/pacmd suspend 0

SuccessExitStatus=0
RemainAfterExit=yes

[Install]
WantedBy=default.target
"

dbus-org.gna.home.a2jmidid.service
"
[Unit]
Description=alsa2jack dbus
Requires=dbus.socket
Requires=dbus-org.jackaudio.service
After=dbus-org.jackaudio.service

[Service]
Type=dbus
BusName=org.gna.home.a2jmidid

ExecStartPre=-/usr/bin/killall -9 a2jmidid
ExecStartPre=-/bin/sleep 2

ExecStart=/usr/bin/a2jmidid dbus
ExecStartPost=/bin/sleep 3
ExecStartPost=/usr/bin/a2j_control ehw
ExecStartPost=/bin/sleep 5
ExecStartPost=/usr/bin/a2j_control start

ExecStop=/usr/bin/a2j_control exit
ExecStopPost=-/bin/sleep 2
ExecStopPost=-/usr/bin/killall -9 a2jmidid

SuccessExitStatus=0
RemainAfterExit=true

[Install]
WantedBy=default.target
"

---
these dbus files also need to be changed
(If your distro is using a slightly different name in /usr/share/dbus-1/services, then you need to use that filename in ~/.local/share/dbus-1/services )

~/.local/share/dbus-1/services/org.jackaudio.service
"
[D-BUS Service]
Name=org.jackaudio.service
#Exec=/usr/bin/jackdbus auto

SystemdService=dbus-org.jackaudio.service
"

---
for dbus unit file org.gna.home.a2jmidid.service
in ~/.local/share/dbus-1/services/ ,
"
[D-BUS Service]
Name=org.gna.home.a2jmidid
#Exec=/usr/bin/a2jmidid dbus

SystemdService=dbus-org.gna.home.a2jmidid.service
"
---

To prepare these units for auto-startup,

systemctl --user reenable dbus-org.gna.home.a2jmidid.service
systemctl --user reenable dbus-org.jackaudio.service
systemctl --user daemon-reload

The daemon-reload statement may be redundant but isn't harmful. The "systemctl --user enable __ " statement doesn't fully create the appropriate symlinks for the .wants folder, that's why you would need to use "reenable" to ensure the correct symlinks are created under the user's systemd sub-folders in ~/.config/systemd/user/.

The "reenable" and daemon-reload statements are not enough to ensure that the unit files are stored in .wants folders, you can verify this by using,
systemctl --user list-dependencies default.target

If a user wants to alter the auto-start behaviour of these two service units in ~/.config/systemd/user, they can use
systemctl --user disable dbus-org.gna.home.a2jmidid
systemctl --user disable dbus-org.jackaudio

to start up manually, one can just do
systemctl --user start dbus-org.gna.home.a2jmidid.service
and that should start up the jackaudio service along with it.

The lines with dp, dps and eps in jack.service can be removed if a user wants to use other tools to store jackdbus settings.

Since I don't trust ~/.config/jack/conf.xml as it could get overwritten by other tools, << this configuration file is where the runtime jackdbus stores it settings.
The thing is jackdbus can be called from different tools. If you're like me and like to try different jack tools but do not want to worry about your settings getting lost, you can always stick with "qjackctl" or you can ammend jack_control statements in the dbus-org.jackaudio.service file as demonstrated.

For checking what settings are taking place with jackdbus,
"jack_control ep" and "jack_control dp" can be used to show the runtime jackdbus settings..

To verify that pulseaudio is indeed pointing to jack_out,

pacmd list-sinks, and look for "*" on the index/name where it says "<jack_out>"

The "pacmd suspend __" takes a 0 or 1 , and works well enough that the null sink module does not need to be used, but I take just an extra step of precaution as the null sink has worked well for me in the past. The pacmd suspend adds even better assurance pulseaudio and jackd won't fight for the alsa device..

While jackdbus is running, "pacmd suspend-sink jack_out 0" makes it possible to output to only jack_out with pulseaudio.. If another sink needs to be used, a command similar to it can be used, but do not use the alsa device that jackdbus wants to grab onto.

For users who have this systemd file on their linux setup,
/usr/lib/systemd/user/pulseaudio.service

and you do not have "--realtime" applied to the pulseaudio command, you can modify it after copying it to your user's path of systemd.

cd ~/.config/systemd/user
cp /usr/lib/systemd/user/pulseaudio.service .

and edit the line containing ExecStart=
eg,
from "ExecStart=/usr/bin/pulseaudio --daemonize=no" from the system's default
to something similar to
"ExecStart=/usr/bin/pulseaudio --daemonize=no --realtime --no-cpu-limit"

If you use jackdbus, don't use jackd. That's the easiest way to go about it..

If you do use jackd, then make sure you do the same check, suspend pulseaudio's sinks, etc.. and it should work the same..

For those who use jackd:
-> the command for a2jmidid with hardware-redirected ports is -> "a2jmidid -e"

A user would notice that I use "jack_control exit" and "a2j_control exit". The reason why I use this is because "jack_control stop" and "a2j_control stop" do not work perfectly sometimes when their dbus activation is still on.

Issuing start/stop with jack_control and/or a2j_control does not always work and so the only way for the two to cooperate again is to bring down the dbus activation and then later reactivate.

It's flakey, so it's best to do a full kill switch on both and that always solves it.

It's a little instructive, but basically you are making just four files and not changing anything outside the user home folder.


good luck
Last edited by mwstl on Mon Sep 30, 2019 3:16 am, edited 3 times in total.

Post

Thanks for documenting this.
Life would be better in many situations on Linux if Bitwig supported Jack MIDI. Every other music app does and it would help when you want Bitwig to be compatible with other music apps on Linux. Sure there are workarounds, but not simple ones.

This has been the #1 complaint with Bitwig on Linux since V1, but it doesn't stop us from using Bitwig, just have to be aware of this shortcoming and work around it.

Post

Amended these changes for the service unit files, as well as implementing "SystemdService=" in the dbus files meant I had to remove "Exec=" from these units.

~/.config/systemd/user/dbus-org.jackaudio.service
"
[Unit]
Description=JACK 2
After=pulseaudio.service
Requires=dbus.socket
Requires=pulseaudio.service

[Service]
Type=dbus
BusName=org.jackaudio.service

ExecStartPre=-/usr/bin/killall -9 jackdbus
ExecStartPre=-/bin/sleep 2
#ExecStartPre=-/usr/bin/pacmd load-module module-null-sink
#ExecStartPre=-/bin/sleep 2
ExecStartPre=-/usr/bin/pacmd set-default-sink null

ExecStartPre=-/usr/bin/pacmd unload-module module-jackdbus-detect
ExecStartPre=-/bin/sleep 1
ExecStartPre=-/usr/bin/pacmd unload-module module-jack-sink
ExecStartPre=-/usr/bin/pacmd unload-module module-jack-source
ExecStartPre=-/bin/sleep 2

ExecStartPre=-/usr/bin/pacmd suspend 1
ExecStartPre=-/bin/sleep 1

ExecStart=/usr/bin/jackdbus auto

ExecStartPost=-/bin/sleep 6
ExecStartPost=/usr/bin/jack_control ds alsa
ExecStartPost=/usr/bin/jack_control dps device hw:NVidia,7
ExecStartPost=/usr/bin/jack_control dps period 512
ExecStartPost=/usr/bin/jack_control dps nperiods 3
ExecStartPost=/usr/bin/jack_control dps rate 48000
ExecStartPost=/usr/bin/jack_control dps input-latency 32
ExecStartPost=/usr/bin/jack_control dps output-latency 32
ExecStartPost=/usr/bin/jack_control dps midi-driver none
ExecStartPost=/usr/bin/jack_control eps driver alsa
ExecStartPost=/usr/bin/jack_control eps realtime True
ExecStartPost=/usr/bin/jack_control eps realtime-priority 95
ExecStartPost=-/bin/sleep 1

ExecStartPost=-/usr/bin/jack_control start
ExecStartPost=-/bin/sleep 3

ExecStartPost=-/usr/bin/pacmd load-module module-jackdbus-detect channels=2 connect=true
ExecStartPost=-/bin/sleep 3
ExecStartPost=-/usr/bin/pacmd set-default-sink jack_out
ExecStartPost=-/usr/bin/pacmd suspend-sink jack_out 0

ExecStop=-/usr/bin/jack_control exit
ExecStopPost=-/bin/sleep 2
ExecStopPost=-/usr/bin/killall -9 jackdbus
ExecStopPost=-/bin/sleep 1

ExecStopPost=-/usr/bin/pacmd unload-module module-jackdbus-detect
ExecStopPost=-/bin/sleep 1
ExecStopPost=-/usr/bin/pacmd unload-module module-jack-sink
ExecStopPost=-/usr/bin/pacmd unload-module module-jack-source
ExecStopPost=-/bin/sleep 1
ExecStopPost=-/usr/bin/pacmd set-default-sink alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
ExecStopPost=-/bin/sleep 2
ExecStopPost=-/usr/bin/pacmd suspend 0

SuccessExitStatus=0
RemainAfterExit=yes


[Install]
WantedBy=default.target

"
-----------------------------
~/.local/share/dbus-1/services/org.jackaudio.service
"
[D-BUS Service]
Name=org.jackaudio.service
#Exec=/usr/bin/jackdbus auto

SystemdService=dbus-org.jackaudio.service
"
-----------------------------
~/.local/share/dbus-1/services/dbus-org.gna.home.a2jmidid.service
"
[Unit]
Description=alsa2jack dbus
Requires=dbus.socket
Requires=dbus-org.jackaudio.service
After=dbus-org.jackaudio.service

[Service]
Type=dbus
BusName=org.gna.home.a2jmidid

ExecStartPre=-/usr/bin/killall -9 a2jmidid
ExecStartPre=-/bin/sleep 2

ExecStart=/usr/bin/a2jmidid dbus
ExecStartPost=/bin/sleep 3
ExecStartPost=/usr/bin/a2j_control ehw
ExecStartPost=/bin/sleep 5
ExecStartPost=/usr/bin/a2j_control start

ExecStop=/usr/bin/a2j_control exit
ExecStopPost=-/bin/sleep 2
ExecStopPost=-/usr/bin/killall -9 a2jmidid

SuccessExitStatus=0
RemainAfterExit=true

[Install]
WantedBy=default.target
"

-----------------------------
~/.local/share/dbus-1/services/org.gna.home.a2jmidid.service
"
[D-BUS Service]
Name=org.gna.home.a2jmidid
#Exec=/usr/bin/a2jmidid dbus

SystemdService=dbus-org.gna.home.a2jmidid.service
"
-----------------------------
commands:

systemctl --user reenable dbus-org.gna.home.a2jmidid.service
systemctl --user reenable dbus-org.jackaudio.service
systemctl --user daemon-reload

These commands recreate the symlinks for the startup under ~/.config/systemd/user for these two new unit files,
On the next bootup these can be verified as working, by verifying with,

systemctl --user list-dependencies default.target

if any of the services failed, there would be a red marker showing which one.

should work better having dbus startup inside ~/.config/systemd/user

Post

^ not to forget that when using Bitwig, to use -> systemctl --user stop dbus-org.gna.home.a2jmidid.service, then launch Bitwig.
(see the notes [ ] at the top for Bitwig)

Post

To help troubleshoot for anyone stuck with this a2jmidid -e /a2jmidid dbus mess,
(cross-posting this, in the likes this alleviates anyone's pain in getting a2j to finally work)

a2jmidid -e or 'a2jmidid dbus' can both connect to either jackd or jackdbus..

however, "a2j_control" statements only work against a2jmidid_dbus.

In order to use a2jmidid dbus, it takes 2 or 3 commands, but with "a2jmidid -e" runs by itself..

The instructions I provided treats things so if the time comes "a2jmidid -e" and "a2jmidid dbus" cannot cross paths to jackdbus and jackd transparently, it is better to say

1) Ok I want non-dbus, so try to use "non-dbus" things, that means-> jackd + a2jmidid -e

or 2) I rather have only dbus services, then fine stick with -> jackdbus + a2jmidid dbus


Further notes, there are users not knowing the difference between a2jmidid -e and a2jmidid dbus,

a2j_control -> is for a2jmidid dbus, not a2jimidi -e

You can verify if you are using a2jmidid's bridge by using
a2j_control status,

It can also be determined if a2jmidid dbus is being used by checking ~/.log/a2j/a2j.log , afaik this log only fills up when a2jmidid dbus is being used, and not a2jmidid -e ..
(issuing a2j_control statements also adds more logging to this file, also confirming that a2jmidid dbus is being used)

If you're like me and want to make sure 'a2jmidid -e' and a2jmidid dbus cannot ever run at the same time, then make sure a2jmidid dbus cannot become auto-activated..

You can prevent "a2jmidid dbus" from becoming auto-activated by using a false Exec= for its server binary..

~/.local/share/dbus-1/services/org.gna.home.a2jmidid.service
"
[D-BUS Service]
Name=org.gna.home.a2jmidid
Exec=/bin/false
"
That should be the same filename as /usr/share/dbus-1/services/org.gna.home.a2jmidid.service (otherwise use the same filename that comes with your distribution)

After creating this dbus unit, you do killall -9 a2jmidid, pgrep -fa a2jmidid to see if it is gone.. then see if "a2j_control status" works.

If the a2j_control command fails, then the override worked and you never have to worry about "a2jmidid dbus" and "a2jmidid -e" from ever trying fighting one another and trying to grab the same hardware ports..

...
If a user on the other wants to use dbus,

they can use either
-> a2jmidid -e &
or
-> a2j_control ehw, a2j_control start,

The dbus-compliant way to work with "a2jmidid dbus" is to have its dbus activation triggered by an a2j_control statement, and not to ever use "a2jmidid -e"..

You can see if your commands are taking effect by checking ~/.log/a2j/a2j.conf -- if this is getting filled up, you are using a2jmidid dbus, and not a2midid -e..
(note: everytime you issue "a2j_control" or an a2j-dbus aware command, you are auto-loading "a2jmidid dbus"

So if you use "a2jmidid -e", and then you are using a2j_control commands, then you are doing things wrongly and may cause conflicts between these two..
To be safe, it is better imho to "block" out from accidentally firing up "a2jmidid dbus" by using that setting override in ~/.local/share/dbus-1/services/org.gna.home.a2jmidid.service
)

for pulseaudio, you'll need to use --realtime applied to it, otherwise you'll have all kinds of xruns with it
(I mention above how to override the default pulseaudio unit file)

fwiw, users should be trying to go towards jackdbus, which is why distros have left these in their auto-configuration state. Since some users do not know how to deactivate or prevent them from auto-activating them, I'm posting this here and there on the web..

I've been learning a lot the last couple days on how to disactivate dbus, the documentation on it is quite scattered making it difficult to put it together, so I'm posting it at a few places.
Despite the saying of disactivating a2j/jack dbus, I think it is better that I adjust to using it as that's likely where things are going.

I see a lot of users typing commands that do not go against the dbus process counterpart and there's a lot of circling advice about how to fix things..

Instead of applying removing systemd unit files, might as well keep the overriding unit files in ~, and do things by working with unit files in simple paths where systemd expects them. My workaround is probably not the best way about it for all users, but a system upgrade should generally not break these custom settings as they are all in ~, and not in places like /lib/systemd/system, or /usr/share/dbus-1/services where they get overwritten by system upgrades. (avoiding system paths)

..
The best way about all of this is if developers can come together to combat this issue, many of us users(including me as well) fall for going with the instruction of doing "a2jmidid -e" when it is not necessary in a dbus-aware system and only adding more confusion to it by trying things like "a2j_control" which is not doing anything against "a2jmidid -e"(and rather it is only meant to work with "a2jmidid dbus")

afaict either form can work with jackd/jackdbus transparently, but I don't think they should be running (a2jmidid -e + a2jmidid dbus) at the same time. (In the future that may change however, so it's better to either stick with dbus-only or non-dbus setups to make things easier)

The problem with a2jmidid's dbus activation file, is you can't have more than 1 Exec= line...(or for any dbus activation file), ..

Also, undocumented is the "~/.config/a2j/a2j.conf" file that is supposed to get parsed, I tried using that instead of relying on typing "a2j_control ehw", "a2j_control start" ... it would be better if a2j.conf actually worked.. I don't think it does, maybe my syntax was not xml-compliant, but I looked at the code and gave it a try.. I'll have to complain to the a2j developers on that..

a2j is difficult to work with... so I just threw that into a systemd unit file, but the mistake many users make here is thinking a2j_control takes care of "a2jmidid -e", what they end up doing is to call up "a2midid dbus", and as a result that may also call up jackdbus, when the user only wants to stick with jackd.

Takes less gray out of the equation--> don't use a2j_control unless you are working with a2jmidid dbus.

You can use "a2jmidid -e" instead of the "a2jmidid dbus" as I have set in the provided examples. If going this route, then I would suggest to block out "a2jmidid dbus" with a simple override which is merely 2 or 3 lines in a dbus unit file.

makes sense at least for me, for both long term and short term, ... I just want this to work without conflicts, and I finally got this pieced together tehehe

gl&hf

Post

mclstr wrote: Thu Aug 22, 2019 1:43 pm Life would be better in many situations on Linux if Bitwig supported Jack MIDI. Every other music app does and it would help when you want Bitwig to be compatible with other music apps on Linux. Sure there are workarounds, but not simple ones.
Let me know if this is simple or not. Xubuntu 18.04 LTS.

1)

in ~/.bashrc:

alias A2J='a2j_control ehw start'
alias KA2J='killall /usr/bin/a2jmidid'

2)

Install pulseaudio-module-jack

This will work with a ~/.jackdrc file and will start both jackd and pulse audio at boot

Add to /etc/pulse/default.pa:

load-module module-jack-sink
load-module module-jack-source

Your jackd settings are in ~/.jackdrc - adjust to your taste.

3)

Boot machine, start Bitwig, create something.

(optional) 4) Mix using Mixbus32C using a Faderport

a) Terminate Bitwig
b) (console) : A2J
c) Start Mixbus32C
d) Mix your tracks
e) Terminate Mixbus32C
f) (console) : KA2J
g) Start Bitwig
h) Create something else

Cheers.

Post

mevla wrote: Thu Aug 22, 2019 11:27 pm Let me know if this is simple or not....
Thanks. I'm sure others will find it helpful as well.

I go back and forth between a number of methods depending on what I need. Right now I am doing everything in Bitwig. And that means a simple basic setup that doesn't need to work with Jack MIDI.

That could change and I may decide to start doing something more complex in the future.

Post

mevla wrote: Thu Aug 22, 2019 11:27 pm Let me know if this is simple or not. Xubuntu 18.04 LTS.
1)
in ~/.bashrc:
alias A2J='a2j_control ehw start'
alias KA2J='killall /usr/bin/a2jmidid'
a2j_control stop, can also be doing it if "a2jmidid dbus" was instantiated, but killall will take down both "a2jmidid -e" as well as a2jmidid dbus".

The way a systemd --user context works is to keep things in official places,
-> ~/.config/systemd/user is an official place for overrides for /usr/lib/systemd/user
mevla wrote: Thu Aug 22, 2019 11:27 pm 2)
Install pulseaudio-module-jack
This will work with a ~/.jackdrc file and will start both jackd and pulse audio at boot
Add to /etc/pulse/default.pa:
load-module module-jack-sink
load-module module-jack-source
Your jackd settings are in ~/.jackdrc - adjust to your taste.
If that does it, then you are already running jackdbus rather than jackd..

pulseaudio's module-jackdbus-detect.so role is to listen to jackdbus requests and to let jackdbus grab alsa sinks, so essentially pulseaudio is already running before jackdbus.

module-jack-sink and module-jack-source are auto-loaded and un-loaded by module-jackdbus-detect..

If you prefer to use "jackd" rather than "jackdbus", then you should comment-out "load-module module-jackdbus-detect" from /etc/pulse/default.pa, this way you can be sure you are only dealing with jackd which only gets its settings from ~/.jackdrc

If you are using qjackctl, it would be using its own settings and then overriding jackd's ~/.jackdrc.

If you are using qjackctl, and you are using it for jackdbus, it would be overriding jackdbus settings in ~/.config/jack/conf.xml

If you are not sure you are using dbus things, you just have to check ~/.log/jack, ~/.log/a2j << and these paths are user dbus/systemd logs for these two services..

^ If you see logs in there, and want to avoid confusion that apps are not starting jackdbus/a2jmidid-dbus on their own, then you need to mask the dbus unit files simply like this,

/home/user/.local/share/dbus-1/services/org.jackaudio.service
[D-BUS Service]
Name=org.jackaudio.service
Exec=/bin/false

^ Overrides
/usr/share/dbus-1/services/org.jackaudio.service
[D-BUS Service]
Name=org.jackaudio.service
Exec=/usr/bin/jackdbus auto

/home/user/.local/share/dbus-1/services/org.gna.home.a2jmidid.service
[D-BUS Service]
Name=org.gna.home.a2jmidid
Exec=/bin/false

^ Overrides
/usr/share/dbus-1/services/org.gna.home.a2jmidid.service
[D-BUS Service]
Name=org.gna.home.a2jmidid
Exec=/usr/bin/a2jmidid dbus

So if an app looks for them prior their non-dbus counterparts, then it will be connecting to jackd and a2jmidid -e as an alternative...

You will have to update your A2J alias to -> "a2jmidid -e &", as the "a2j_control" command in itself already is instantiating "a2jmidid dbus".

You can test whether the mask is working or not by typing "a2j_control status" alone and seeing if you are getting startup errors.

"a2j_control status
Traceback (most recent call last):
File "/usr/bin/a2j_control", line 106, in <module>
..
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gna.home.a2jmidid exited with status 1
"

In your case you want to mask the two dbus unit files because you're preferring to use jackd.
> When you're doing "a2j_control ehw start" or "a2j_control start" , you are already likely starting up jackdbus via dbus-org.jackaudio.service.

...

A better solution pertaining whether to use pulseaudio or not, is instead to go with alsa-plugin-jack, as it does not conflict with jack.

This allows auser to use alsa clients to connect to jack->alsa instead instead of going through pulseaudio.

The audio routing then becomes {alsa-plugin-jack}->jack->alsa, rather than
The audio routing then becomes pulseaudio->jack->alsa

, but the ~/.asoundrc configuration needs to be updated to use it.
(and alsa's module also needs to be installed to support it)

~/.asoundrc
"
pcm.rawjack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
}

capture_ports {
0 system:capture_1
1 system:capture_2
}
}

pcm.jack {
type plug
slave { pcm "rawjack" }
hint {
description "JACK Audio Connection Kit"
}
}

pcm.!default {
type plug
slave { pcm "rawjack" }
}
"

I do not know of the best way to create a softvol for this setup, but it should be possible. (If anybody knows they can post about it, I haven't been able to do so.)

I was told by that pulseaudio is able to achieve greater peformance than using alsa-plugin-jack, but I haven't noticed a difference much difference between these two.

Going with alsa-plugin-jack, you never have to worry about alsa-grab problems between pulseaudio and jack, so this method may be easier to deal with.

Post

I should note that the audio routing when mentioning {alsa-plugin-jack}->jack->alsa is only for alsa-clients and not Bitwig. (This makes it possible to have Desktop applications to still have sound, just as the same objective of having pulseaudio->jack->alsa}.

The Bitwig studio should be doing jack->alsa, so make sure Bitwig is set to 'Jack'.

If BitWig is set to "alsa", the audio routing would not be {alsa-plugin-jack}->jack->alsa(and rather just Bitwig->alsa). In this case other non-Bitwig alsa clients would not be able to connect because Bitwig would be grabbing the alsa device entirely. This makes it ideal for dedicated daw stations but would not be suitable for sound applications that also use the same sound device.(setting Bitwig to alsa prevents other applications from connecting to the same audio device.)

Jack and alsa-plugin-jack are virtual drivers that would eventually connect to the real alsa driver.

here on debian linux, the package which contains the alsa-plugin-jack module is found here,
libasound2-plugins: /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_jack.so

and the package naming may be different for other distros..

for further details a user can consult the following resources to their benefit,
"Asoundrc - AlsaProject"
https://alsa-project.org/main/index.php ... ACK_plugin

"JACK Audio Connection Kit|How do I route audio to/from generic ALSA-using applications?"
http://www.jackaudio.org/faq/routing_alsa.html

Post

mwstl wrote: Mon Sep 09, 2019 11:47 pm "In your case you want to mask the two dbus ..."
I think you are actively trying to discourage people from using Linux with all that incredibly lengthy nerd-muscle flexing stuff. And when someone shows otherwise, you close the thread, like you did before here.

Folks, Linux is really much more simpler than that.

Post

True. It's simpler by not needing to use pulseaudio. It is you who was requesting on above who wants to stick to their guns with pulseaudio, so either you can take it or you can leave it as a remark for others who may actually benefit from it.

However said, Bitwig is not user-friendly to Linux and lacks JACK-compliancy, so this really has nothing to do with how complex Linux is.

Post

mwstl wrote: Tue Sep 10, 2019 12:24 am True. It's simpler by not needing to use pulseaudio. It is you who was requesting on above who wants to stick to their guns with pulseaudio, so either you can take it or you can leave it as a remark for others who may actually benefit from it.

However said, Bitwig is not user-friendly to Linux and lacks JACK-compliancy, so this really has nothing to do with how complex Linux is.
Once again.

I boot the machine, Xubuntu 18.,04 LTS, I start Bitwig, I start firefox, and everything is ready to go. Bitwig uses jackd, firefox uses pulseaudio. Novation 49-key keyboard, Melda production and Voxengo Windows VST audio processing plugins, a Tone2 or Rob Papen Windows VST synth, while firefox plays a youtube Rob Papen live streaming on the Blue2 synth.

That's it.

To you it might not be user-friendly, but then one could question what is user-friendliness for you actually. Isn't it.

Post

:party:

Post Reply

Return to “Bitwig”