No one should ever bother with bridging ALSA and JACK.

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

No one should ever bother with bridging ALSA and JACK.

Post by crocket »

Bridging ALSA and JACK without major backfiring effects like pops and xruns is enormously difficult and can take months of dedicated efforts.
After months of dedicated efforts, I obtained the best result possible.
But, even the perfect result possible from the bridge is worse than using ALSA alone.
It can be done, but you should not bother with it even if someone else implements and maintains it for you for free.
It's fragile and can break after you update linux kernel.

If you are thinking about bridging ALSA and JACK, just don't.
Stick to either ALSA, JACK, or Pulseaudio. Don't bridge them.

In the future, pipewire may directly plug into JACK. But, you are going to have to wait for 20 years for pipewire to become useful to average users.
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: No one should ever bother with bridging ALSA and JACK.

Post by bluebell »

A good solution for a multi purpose PC is installing Pulseaudio and configuring it with jack-sink, then using JACK as the main audio system.

ALSA-, JACK- and Pulseaudio-clients live happily together.

Even a remote Windows7 VM running on a Linux KVM Host in another building (coupled with directed WiFi) can play Soundcloud-clips with Firefox and output its sound to the Virtuel Machine Manager's Viewer.

But I have only some experience with Intel PCs and audio, not with Raspberries.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

nils
Established Member
Posts: 537
Joined: Wed Oct 22, 2008 9:05 pm
Has thanked: 35 times
Been thanked: 94 times
Contact:

Re: No one should ever bother with bridging ALSA and JACK.

Post by nils »

For years now I am just using my good sound card for jack and my internal mainboard sound for ALSA. Both are routed into an analogue mixer.

No pulse, no bridges, no pain. Just works.
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: No one should ever bother with bridging ALSA and JACK.

Post by sysrqer »

What uses only alsa these days? I honestly don't know why it would be needed.

Pulseaudio bridged to JACK works perfectly for everything I've tried for non music making stuff and for music making everything uses JACK directly and isn't really affected by pulseaudio being bridged (I know others have different opinions about this though).
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: No one should ever bother with bridging ALSA and JACK.

Post by bluebell »

sysrqer wrote:What uses only alsa these days? I honestly don't know why it would be needed.

Pulseaudio bridged to JACK works perfectly for everything I've tried for non music making stuff and for music making everything uses JACK directly and isn't really affected by pulseaudio being bridged (I know others have different opinions about this though).
Squeezelite is an ALSA client, it's a software version of the Slimdevices (later Logitech) Squeezebox. If you have an infrastructure with a Logitec Media Server (Open Source) and several Squeezeboxes then you might want to use PCs or Raspberries as audio players. Because Logitec has abandoned the Squeezebox series. Was too good.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: No one should ever bother with bridging ALSA and JACK.

Post by khz »

What I don't understand is that instead of jackd Pulseaudio has prevailed.
But most of all I would have liked to see "KLANG — Kernel Level Audio Next Generation" http://klang.eudyptula.org/ as default and use this.
Instead we have ALSA for the modules (drivers) and, hurra, 2 soundserver (Pulseaudio/jackd).

KISC principle != KISS principle
# C == Complicated
. . . FZ - Does humor belongs in Music?
. . GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
  • I don't care about the freedom of speech because I have nothing to say.
User avatar
nikgnomicradio
Established Member
Posts: 109
Joined: Wed Feb 07, 2018 9:31 pm
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: No one should ever bother with bridging ALSA and JACK.

Post by nikgnomicradio »

I spent a couple of years trying to get ALSA loopbacks and never found a solution that worked well

but Pulseaudio Jack Sink/Source connections have been no problem for me since Pulseaudio v6.0
it isn't necessary for a lot of audio tasks but many users still want to hear Pulseaudio
I find Pulseaudio ok to run alongside JACK most of the time, or suspend it if i want it out of the way

Don't expect to see any pipe dream to replace all of this with just one thing
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

Re: No one should ever bother with bridging ALSA and JACK.

Post by crocket »

1. You can eliminate pops, crackles, clicks, and xruns in the bridge between ALSA and JACK.

You can do so by replacing ALSA loopback with a dedicated USB soundcard. Plug SPDIF output of an onboard soundcard into SPDIF input of a USB soundcard. Route all system sounds to SPDIF out. Run zita-a2j on SPDIF input.

2. However, this method requires maintenance over time because it is still a lot more fragile than just using ALSA.

You have to tweak kernel preemption, real-time process priorities, cgroup real-time bandwidth, etc, ... in order to eliminate imperfections.
Just read The best way to bridge ALSA and JACK that I found. to understand that it can take months to figure out every detail.
I'm pretty sure that I will experience more issues later when things change. Things always change in unexpected ways over time.

3. Pulseaudio can output to JACK, but JACK module for pulseaudio is worse than the perfect bridge between ALSA and JACK.

I concentrated on the sound from the bridge between pulseaudio and JACK. I heard a few pops from the bridge.
I guess that it also logs xruns. You just haven't bothered to check xruns in the log. It is only slightly better than ALSA loopback, but they are in the same league.

4. I eradicated pulseaudio in my Gentoo system. My audio system will soon consist purely of ALSA.

Gentoo makes it possible. Even firefox and torbrowser run on ALSA.
Gentoo compiled firefox and torbrowser against ALSA. Soon, I will remove JACK, and my computer audio system is going to consist purely of ALSA. I have respect for purity. Gentoo is for purists.

5. In my experiences,

Using Pulseaudio, ALSA, or JACK alone >>>> The perfect USB soundcard bridge between ALSA and JACK >>>> The bridge between Pulseaudio and JACK > The naive ALSA loopback bridge between ALSA and JACK

6. Pipewire is going to plug directly into JACK instead of buffering audio data for JACK.

But, it is not going to become useful to average users for the next 20 years.
Post Reply