[pulseaudio-discuss] PulseAudio null sink monitor gives distorted audio randomly

Mikael Nousiainen mikaelnousiainen at fastmail.com
Thu Nov 8 09:00:50 UTC 2018

I've got a very weird issue with PulseAudio when trying to route audio
from one application (Firefox 64.0b7 (64-bit)) to another one (WSJT-X v1.9.1).
I'm experiencing the same issue with different browsers (Chrome and Chromium too).
The browser is receiving audio from a radio transceiver through a WebRTC
connection and I'm feeding it to WSJT-X to decode the data in the audio signal.

I'm using two module-null-sink modules to transfer the audio between
the browser and WSJT-X. I use pavucontrol to make the browser play audio to
null sink called "radio-output" and then let WSJT-X listen to the audio
via "radio-output.monitor". The kind of setup exists for transmitted audio
where WSJT-X feeds audio to the browser through a null sink called "radio-input".

However, the issue her is that WSJT-X is mostly not able to decode the data
when it's using "radio-output.monitor" as audio input. Sometimes it works
and sometimes it does not. As a technical detail, I'm trying to decode FT8
digital mode traffic and I've confirmed that the reason is not related to
bad time sync (which FT8 requires), because I can even play the browser
audio through laptop speakers and let WSJT-X use the laptop microphone as
audio input and it decodes the data just fine -- the audio sounds clean
and strong with no audible artifacts.

By looking at the waterfall display of WSJT-X when using "radio-output.monitor"
as audio input, I can see some artifacts appearing randomly in the frequency
domain data -- I would call this distortion, but it's hard to know as I cannot
hear it. I can set up a loopback module to feed "radio-output.monitor" to the
speakers and the audio sounds fine. Lowering the incoming volume
radically, e.g. to 10-20% of the full volume, does not help. And occasionally,
couple of times a minute -- and sometimes for a longer period of time --
these artifacts disappear and WSJT-X is able to decode all data flawlessly.

Please see this screenshot for details: https://ibb.co/eiEo0A

I'm using a powerful PC (a quad-core Xeon with 48GB RAM) running Fedora 28
with latest updates applied and CPU usage is quite low (20-30%) during
decoding. PulseAudio version is 12.2-rebootstrapped packaged by Fedora 28.

Pulseaudio daemon.conf has default settings, except for the sample rate:

default-sample-format = s16le
default-sample-rate = 48000

Also, I have the following null sink / loopback setup in default.pa file:

# Loopback devices
load-module module-null-sink sink_name=radio-output sink_properties=device.description="radio-output"
load-module module-null-sink sink_name=radio-input sink_properties=device.description="radio-input"
load-module module-loopback source=radio-output.monitor latency_msec=100 adjust_time=0 rate=48000
load-module module-loopback source=radio-input.monitor latency_msec=100 adjust_time=0 rate=48000

The latter loopback modules are there so that I can hear what is being fed into
the null sinks, but I've confirmed the same behavior even *WITHOUT* the
loopback modules.

I've also set up a fixed latency range for the hardware sound cards, but
I believe this should not have any effect on the null sinks or loopback modules:

load-module module-udev-detect tsched=yes tsched_buffer_size=65536 fixed_latency_range=yes

I am not sure if these audio artifacts are caused by PulseAudio, WSJT-X
or some specific configuration issue in my system. Any ideas?

More information about the pulseaudio-discuss mailing list