[SOLVED] How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

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

[SOLVED] How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by crocket »

jack 1.9.12
zita-alsa-pcmi-0.3.2
zita-resampler-1.6.2
zita-ajbridge-0.8.2

I want to bridge ALSA applications to jack. I tried alsa loopback with alsa_in and zita-a2j.
Both alsa_in and zita-a2j seem to produce pop sounds at least once every minute.

Sound Output ---(Optional) dmix---> hw:Loopback,0,0 ---> hw:Loopback,1,0 = pcm.cloop --- zita-a2j or alsa_in ---> jack/cloop ---> jack/system

jackd -P 90 -d alsa -d hw:SB,0 -p 256 -n 3
"alsa_in -j cloop -d cloop -c 2 -p 2048 -n 3 -q 0" or "zita-a2j -j cloop -d cloop -p 256 -n 3 -r 48000 -c 2"
jack_connect cloop:capture_1 system:playback_1
jack_connect cloop:capture_2 system:playback_2

"mpv --audio-device=alsa/hw:Loopback,0,0 /path/to/file" or "mpv --audio-device=alsa/dmix /path/to/file"

I also tested zita-j2a which doesn't produce pop sounds.

How can I eliminate pop sounds from alsa_in or zita-a2j?

UPDATE: My latest comment on this thread mentions a few solutions.
Last edited by crocket on Sun Aug 04, 2019 1:03 pm, edited 1 time in total.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by lilith »

Crackles or pops? Any difference when changing the sampling rate? I have similar problems with the alsa and zita bridges. Pulseaudio works fine instead. In my case it seems to be a bug in the alsa soundcard driver.
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: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by khz »

lilith wrote:Crackles or pops? Any difference when changing the sampling rate? I have similar problems with the alsa and zita bridges. Pulseaudio works fine instead. In my case it seems to be a bug in the alsa soundcard driver.
Pulseaudio also uses the alsa soundcard driver. All audio uses ALSA.
Then it should also produce errors with Pulseaudio if it was a bug in the alsa soundcard driver?
. . . 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
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by lilith »

Good point. I will check tomorow what a guy from alsa and falkTX wrote me in IRC. I should still have the logs somewhere. Can also be a bridge problem.
Jack Winter
Established Member
Posts: 381
Joined: Sun May 28, 2017 3:52 pm

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by Jack Winter »

FWIW, I never got the alsa jack plugin nor the alsa loopback interface + alsa_in/out working perfectly, did spend quite a lot of time on it. The PA bridge seems to work fine though (except quite high latency).
Reaper/KDE/Archlinux. i7-2600k/16GB + i7-4700HQ/16GB, RME Multiface/Babyface, Behringer X32, WA273-EQ, 2 x WA-412, ADL-600, Tegeler TRC, etc 8) For REAPER on Linux information: https://wiki.cockos.com/wiki/index.php/REAPER_for_Linux
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by crocket »

Jack Winter wrote:FWIW, I never got the alsa jack plugin nor the alsa loopback interface + alsa_in/out working perfectly, did spend quite a lot of time on it. The PA bridge seems to work fine though (except quite high latency).
Ideally, all applications should expose jack ports and not mess with jack patchbay.

Is there a web browser that supports jack properly? Firefox supports jack half-assedly. It tries to be its own patchbay, and I can't turn firefox internal jack patchbay off. It also doesn't expose microphone to jack.

Chromium-based browsers are not going to support jack.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by lilith »

lilith wrote:Good point. I will check tomorow what a guy from alsa and falkTX wrote me in IRC. I should still have the logs somewhere. Can also be a bridge problem.
I found it. Problem is that the format (e.g. S32_LE) used by the alsa bridge is not supported by my interface driver while direct alsa can use a different format.
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by crocket »

lilith wrote:I found it. Problem is that the format (e.g. S32_LE) used by the alsa bridge is not supported by my interface driver while direct alsa can use a different format.
What do you mean by direct alsa? Do you mean alsa loopback?

In my asoundrc, every device including alsa loopback conforms to S32_LE format.

Did you figure out how to fix the issue?
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by lilith »

crocket wrote:
lilith wrote:I found it. Problem is that the format (e.g. S32_LE) used by the alsa bridge is not supported by my interface driver while direct alsa can use a different format.
What do you mean by direct alsa? Do you mean alsa loopback?

In my asoundrc, every device including alsa loopback conforms to S32_LE format.

Did you figure out how to fix the issue?
Yes, when I use direct alsa, i.e. not using Jack but choosing Alsa directly in a DAW for instance the sound is good. As soon I use the bridge (e.g. firefox -> alsa loopback -> jack) I get crackles. When I use pulseaudio jack the sound is also good. I never found a solution for this and finally came to the conclusion that it's a problem of the interface (Zoom R8). What interface are you using and what Linux and kernel version?
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by crocket »

lilith wrote:As soon I use the bridge (e.g. firefox -> alsa loopback -> jack) I get crackles. When I use pulseaudio jack the sound is also good. I never found a solution for this and finally came to the conclusion that it's a problem of the interface (Zoom R8). What interface are you using and what Linux and kernel version?
When I use jack locally, the interface is the onboard sound card called
Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
When I use netjack1, the master interface is HiFiBerry Amp2.

Both netjack1 and local jack experience crackles when alsa loopback is involved.
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by crocket »

According to
aplay -D alsa-device --dump-hw-params /path/to/any_sound_file
the following devices support S32_LE
  • The onboard soundcard of my desktop
  • HiFiBerry Amp2
  • ALSA loopback
  • dmix based on ALSA loopback and any hardware sound interface
When only ALSA is used, S32_LE is supported properly. You mentioned that crackles happen because sound interfaces don't support S32_LE.
If I made everything conform to S16_LE format, would crackles go away?
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by crocket »

lilith wrote:what Linux and kernel version?
Gentoo Linux
4.19.27-gentoo-r1 on my desktop computer
4.19.30-v8+ on raspberry pi 3 B+ which runs HiFiBerry Amp2
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by lilith »

The S32_LE was just an example. I don't know which formal is used by the alsa bridge or by pure alsa. Can you make a test with an AVLinux stick? Sorry, I can't offer any solution. Maybe tramp or CrocoDuck knows what might be going on? Or you ask at the KXstudio channel on IRC or Discord.
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by crocket »

lilith wrote:The S32_LE was just an example. I don't know which formal is used by the alsa bridge or by pure alsa. Can you make a test with an AVLinux stick? Sorry, I can't offer any solution. Maybe tramp or CrocoDuck knows what might be going on? Or you ask at the KXstudio channel on IRC or Discord.
It seems that I need to follow instructions on
The latter 2 links talk about cgroup realtime scheduling. I haven't yet tested cgroup realtime scheduling. Tomorrow, I will test it.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: How can I eliminate pop sounds from alsa_in and zita-a2j working on ALSA loopback?

Post by merlyn »

crocket wrote:Firefox supports jack half-assedly. It tries to be its own patchbay, and I can't turn firefox internal jack patchbay off.
I use Firefox with JACK. I use Arch and the version of Firefox in the official Arch repos has been compiled with JACK support.

I use Catia to manage JACK connections and Firefox appears as a JACK client called 'Audio IPC Server'. It auto-connects to the system outputs. Other than that I'm not sure what you mean about Firefox being its own patchbay.
Post Reply