[OBSOLETE] Don't bridge ALSA and JACK through ALSA loopback and alsa_in.
Moderators: MattKingUSA, khz
[OBSOLETE] Don't bridge ALSA and JACK through ALSA loopback and alsa_in.
ALSA applications on my desktop --> ALSA loopback --> alsa_in or zita-a2j --> netjack --> jack server on Raspberry Pi 3 B+
The above audio pathway injects a lot of pops and crackles into audio because alsa_in and zita-ajbridge are not designed to read audio from ALSA applications through ALSA loopback. They are designed to read audio from sound cards. Xruns, pops, and crackles occur more frequently when CPU is busy. It is virtually impossible for ALSA loopback to become as reliable as a sound card because ALSA loopback doesn't have a regular word clock, but a sound card does.
You can bridge ALSA and JACK through line-out and line-in.
Connect line-out of your desktop computer to line-in of a USB sound card or a USB audio interface plugged into jack server.
alsa_in or zita-a2j can turn line-in into a JACK client.
After line-in becomes a JACK client, you can use netjack or whatever jack backends you want to use.
ALSA applications on my desktop --> line-out ---> line-in of a high quality USB audio interface ---> jack server on Raspberry Pi 3 B+
With this method, high CPU loads on the computer that sends audio to line-out don't cause xruns because alsa_in reads from a hardware instead of ALSA loopback and runs on the jack server where CPU is not busy.
For line-in to deliver high-quality audio, you need a proper USB audio interface. I'm thinking about buying Behringer U-Control UCA202 USB Audio Interface for adding a high quality line-in to my Raspberry Pi 3 B+.
If ALSA applications and jack server both reside in the same machine, you would need two sound cards for this.
So, the conclusion is that if you want to bridge ALSA and JACK, buy a sound card which has a high quality line-in.
The above audio pathway injects a lot of pops and crackles into audio because alsa_in and zita-ajbridge are not designed to read audio from ALSA applications through ALSA loopback. They are designed to read audio from sound cards. Xruns, pops, and crackles occur more frequently when CPU is busy. It is virtually impossible for ALSA loopback to become as reliable as a sound card because ALSA loopback doesn't have a regular word clock, but a sound card does.
You can bridge ALSA and JACK through line-out and line-in.
Connect line-out of your desktop computer to line-in of a USB sound card or a USB audio interface plugged into jack server.
alsa_in or zita-a2j can turn line-in into a JACK client.
After line-in becomes a JACK client, you can use netjack or whatever jack backends you want to use.
ALSA applications on my desktop --> line-out ---> line-in of a high quality USB audio interface ---> jack server on Raspberry Pi 3 B+
With this method, high CPU loads on the computer that sends audio to line-out don't cause xruns because alsa_in reads from a hardware instead of ALSA loopback and runs on the jack server where CPU is not busy.
For line-in to deliver high-quality audio, you need a proper USB audio interface. I'm thinking about buying Behringer U-Control UCA202 USB Audio Interface for adding a high quality line-in to my Raspberry Pi 3 B+.
If ALSA applications and jack server both reside in the same machine, you would need two sound cards for this.
So, the conclusion is that if you want to bridge ALSA and JACK, buy a sound card which has a high quality line-in.
Last edited by crocket on Thu Aug 08, 2019 12:23 pm, edited 1 time in total.
- turbidh20
- Established Member
- Posts: 190
- Joined: Sun Aug 04, 2019 12:48 pm
- Location: UK
- Has thanked: 8 times
- Been thanked: 2 times
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
Hi crocket, I've just bought a Behringer UMC204HD USB interface to get back into recording. I love it!
My MB has onboard Intel HD Audio (Z97/ALC1150) and I've now started using a simple .asoundrc with all ALSA playback not routed through Jack running through Loopback. It's working great for me with my setup.
I was a bit confused by Jack to start but I've twigged how Patchbay works now and keep adding stuff to it as the need arises. I do have the mic from my crappy headset still plugged directly into the onboard card and use that for Skype (and the out in the back of the UMC204HD).
My MB has onboard Intel HD Audio (Z97/ALC1150) and I've now started using a simple .asoundrc with all ALSA playback not routed through Jack running through Loopback. It's working great for me with my setup.
I was a bit confused by Jack to start but I've twigged how Patchbay works now and keep adding stuff to it as the need arises. I do have the mic from my crappy headset still plugged directly into the onboard card and use that for Skype (and the out in the back of the UMC204HD).
Arch Linux (i7-4790k/GTX970); UMC204HD; MPK Mini MKII; Jack2 (QjackCtl) & Ardour/Mixbus
- bluebell
- Established Member
- Posts: 1924
- Joined: Sat Sep 15, 2012 11:44 am
- Location: Saarland, Germany
- Has thanked: 112 times
- Been thanked: 119 times
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
Huh? What's wrong with ~/.asoundrc?
Code: Select all
pcm.!default {
type plug
slave { pcm "rawjack" }
}
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"
}
}
Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
I found a better way. To eliminate signal loss, I can connect S/PDIF optical out to S/PDIF optical in. alsa_in is going to read audio from S/PDIF optical in.
Since my onboard soundcard has S/PDIF optical out, I just need to buy a device that has S/PDIF optical in.
If I buy a USB sound card with S/PDIF optical in, I can plug it into my desktop computer or my Raspberry Pi 3 B+.
If I buy a PCI(e) sound card with S/PDIF optical in, I can insert it into my desktop computer.
Since my onboard soundcard has S/PDIF optical out, I just need to buy a device that has S/PDIF optical in.
If I buy a USB sound card with S/PDIF optical in, I can plug it into my desktop computer or my Raspberry Pi 3 B+.
If I buy a PCI(e) sound card with S/PDIF optical in, I can insert it into my desktop computer.
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
I read that jack alsa plugin creates pops and crackles in audio. In addition, http://www.jackaudio.org/faq/routing_alsa.html saysbluebell wrote:Huh? What's wrong with ~/.asoundrc?Code: Select all
pcm.!default { type plug slave { pcm "rawjack" } } 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" } }
When I test jack alsa plugin with mpv, mpv freezes.The simpler approach has its drawbacks: if an application stops playing audio, it will disappear from the JACK world, which can be quite inconvenient. Some people have also found it quite buggy or unstable in some situations. For basic audio playback, it works quite well but when used with a more demanding application or one with more of its own “quirks” (e.g. VirtualBox), this approach isn’t recommended.
- turbidh20
- Established Member
- Posts: 190
- Joined: Sun Aug 04, 2019 12:48 pm
- Location: UK
- Has thanked: 8 times
- Been thanked: 2 times
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
Interesting, I didn't know about the ALSA Jack plugin. Just looked it up and will now try it.bluebell wrote:Huh? What's wrong with ~/.asoundrc?
Last edited by turbidh20 on Tue Aug 06, 2019 4:35 pm, edited 1 time in total.
Arch Linux (i7-4790k/GTX970); UMC204HD; MPK Mini MKII; Jack2 (QjackCtl) & Ardour/Mixbus
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
ALSA jack plugin freezes mpv and vlc.turbidh20 wrote:bluebell wrote:Huh? What's wrong with ~/.asoundrc?
Interesting, I didn't know about the ALSA Jack plugin. Just looked it up and will now try it.
- turbidh20
- Established Member
- Posts: 190
- Joined: Sun Aug 04, 2019 12:48 pm
- Location: UK
- Has thanked: 8 times
- Been thanked: 2 times
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
I Just tried the ALSA Jack plugin and it's too flakey. Skype's a complete no-go and bombs out and no audio through my browser (Pale Moon). VLC bombs too. Plenty of xruns also. Loopback it is then!
Arch Linux (i7-4790k/GTX970); UMC204HD; MPK Mini MKII; Jack2 (QjackCtl) & Ardour/Mixbus
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
Is it possible to run alsa_in on S/PDIF optical in and avoid xruns, pops, or clicks from clock jitter?
Last edited by crocket on Tue Aug 06, 2019 5:12 pm, edited 1 time in total.
- bluebell
- Established Member
- Posts: 1924
- Joined: Sat Sep 15, 2012 11:44 am
- Location: Saarland, Germany
- Has thanked: 112 times
- Been thanked: 119 times
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
That's strange, because Pulseaudio does a similar redirection for ALSA clients somewhere in /usr/share/alsa.
Did you try to install Pulseaudio and jack-sink? On my PCs the redirection ALSA -> Pulseaudio -> jack works flawlessly.
For example the squeezelite audioplayer outputs to ALSA, gets redirected to Pulseaudio which outputs via jack-sink to jack. That works fine even with "jack_bufsize 12" without xruns and noises. So it's probably not very resource-hungry.
Did you try to install Pulseaudio and jack-sink? On my PCs the redirection ALSA -> Pulseaudio -> jack works flawlessly.
For example the squeezelite audioplayer outputs to ALSA, gets redirected to Pulseaudio which outputs via jack-sink to jack. That works fine even with "jack_bufsize 12" without xruns and noises. So it's probably not very resource-hungry.
Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
I don't want to use pulseaudio.bluebell wrote:That's strange, because Pulseaudio does a similar redirection for ALSA clients somewhere in /usr/share/alsa.
Did you try to install Pulseaudio and jack-sink? On my PCs the redirection ALSA -> Pulseaudio -> jack works flawlessly.
For example the squeezelite audioplayer outputs to ALSA, gets redirected to Pulseaudio which outputs via jack-sink to jack. That works fine even with "jack_bufsize 12" without xruns and noises. So it's probably not very resource-hungry.
Re: Don't bridge ALSA and JACK through ALSA loopback and alsa_in. There's a better way.
It seems that sending audio via line-out and line-in is the only reliable way.
S/PDIF has clock synchronization issue that I may not be able to fix. line-out and line-in don't have such synchronization issue.
I am looking into Behringer U-Control UCA202 or UCA222.
S/PDIF has clock synchronization issue that I may not be able to fix. line-out and line-in don't have such synchronization issue.
I am looking into Behringer U-Control UCA202 or UCA222.