A decent sound card seems to eliminate pops and clicks in the bridge between ALSA and JACK.

Optimize your system for ultimate performance.

Moderators: khz, MattKingUSA

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

A decent sound card seems to eliminate pops and clicks in the bridge between ALSA and JACK.

Postby crocket » Tue Aug 13, 2019 12:26 pm

For months, I tried to make the bridge between ALSA and JACK work without pops and clicks.
Eventually, I realized it was impossible because ALSA loopback is not a proper soundcard with a proper clock.

Today, I received an S/PDIF optical cable and Creative Sound Blaster X-Fi HD which I ordered yesterday.

I tested the following setup which seems to work fine for a few hours without pops, clicks, or xruns from zita-ajbridge.
However, I will have to test it for a month to be really sure. In particular, I want to test whether the setup doesn't produce pops, clicks, or xruns for hours while the CPU load is close to 100% due to heavy compilation tasks because I compile gentoo packages with niceness value of 19 for regular system upgrades.

Sound quality:
Sample Format // S16LE (16bit integer)
Sampling Rate // 48000
Channels // 2

On my gentoo desktop computer:
1. ALSA applications --> ALSA dmix (period_size 512, periods 3) --> SPDIF optical output of Realtek ALC887 onboard soundcard --> SPDIF optical input of Creative Sound Blaster X-Fi HD SB1240 --(zita-a2j -p 128 -n 3)--> jackd -P 90 -d netone -p 256 -n 3
2. JACK clients such as mpv and firefox --> jackd -P 90 -d netone -p 256 -n 3
3. jackd -P 90 -d netone -p 256 -n 3 --(zita-j2a -p 128 -n 3)--> headphone jack of Creative Sound Blaster X-Fi HD SB1240 --> headphones

On Raspberry Pi 3 B+:
1. jackd -P 90 -d netone -p 256 -n 3 from my desktop computer ==(ethernet cable)==> jack_netsource -n 3 -H ip_address_of_my_desktop_computer --> jackd -P 90 -d alsa -p 256 -n 2 --> HiFiBerry Amp2 --> passive speakers
2. JACK clients such as mpd --> jackd -d alsa -p 256 -n 2 --> HiFiBerry Amp2 --> passive speakers

Kernel Settings:
PREEMPT=y
IRQ_FORCED_THREADING=y
HZ=1000
HZ_1000=y
CPU_FREQ_DEFAULT_GOV_PERFORMANCE

Cgroup Settings:
"audio" cgroup allocates 95% of CPU time to real-time threads of jackd, jack_netsource, zita-a2j, and zita-j2a on my desktop computer and Raspberry Pi 3 B+.

PAM limits.conf settings:
1. "nice -n -20" is allowed. I want this for mpv while heavy compilation tasks are executed with niceness value of 19.
2. Real-time process priority of up to 99 is allowed.

My desktop computer and Raspberry Pi 3 B+ share a pair of passive speakers. My desktop computer can switch between passive speakers and headphones. On my desktop computer, a keyboard shortcut commands jack connection manager to switch between speaker mode and headphone mode. I wrote my own jack connection manager in python.

This setup has two advantages.

1. It eliminates pops and clicks between ALSA loopback and zita-ajbridge. It also removes xruns and crackles from zita-ajbridge.
1. The headphone jack of X-Fi HD is far better than that of Realtek ALC887 onboard soundcard. I'm enjoying superior sound experience with my headphones.

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

Re: A decent sound card seems to eliminate pops and clicks in the bridge between ALSA and JACK.

Postby crocket » Tue Aug 13, 2019 11:30 pm

Other problems are solved, but I still occasionally get xruns from netjack1, zita-a2j, or zita-j2a.
I'm going to tweak period size and the number of periods to eliminate xruns.


Return to “System Tuning and Configuration”

Who is online

Users browsing this forum: No registered users and 2 guests