Solved Audible clicks with OSS(v4) on USB DAC/AMP

My audible clicks are back again ...
Just to be sure I tested my hardware on Windows, too, without having any audible clicks.
I have followed this guide step-by-step.

I tried to change quite a few parameters, but no luck.
I am using ncmpcpp + mpd in realtime.
The processes are running as regular user.
I have also tried mpv, too.

I am using hardware-wise PEQ.
My USB DAC/AMP has only an USB-C input.
Currently I have plugged it in a USB-3.1 output with a USB-3.0 to USB-C cable.

Quoted from the guide:
In addition, out of chronic duty, one more problem should be mentioned, especially for hardware configurations using USB DAC devices – random, once in a dozen minutes interference, audible clicks during playback. Although there is no rule here – in one hardware specification everything will be OK, in another not so much. This is a subject for a separate article, but if the problem has appeared, despite lengthy attempts with different delay parameters, buffers, debugging PCM devices and studying the mutual interference of individual components, I have so far not found a solution.

My hw.snd settings:
Code:
Input:
# sysctl hw.snd

Output:
hw.snd.maxautovchans: 16
hw.snd.default_unit: 11
hw.snd.default_auto: 0
hw.snd.verbose: 2
hw.snd.vpc_mixer_bypass: 0
hw.snd.feeder_rate_quality: 1
hw.snd.feeder_rate_round: 0
hw.snd.feeder_rate_max: 2016000
hw.snd.feeder_rate_min: 1
hw.snd.feeder_rate_polyphase_max: 183040
hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97
hw.snd.feeder_eq_exact_rate: 0
hw.snd.feeder_eq_presets: PEQ:16000,0.2500,62,0.2500:-9,9,1.0:44100,48000,88200,96000,176400,192000
hw.snd.basename_clone: 1
hw.snd.compat_linux_mmap: 0
hw.snd.syncdelay: -1
hw.snd.usefrags: 0
hw.snd.vpc_reset: 0
hw.snd.vpc_0db: 45
hw.snd.vpc_autoreset: 1
hw.snd.timeout: 5
hw.snd.latency_profile: 1
hw.snd.latency: 0
hw.snd.report_soft_matrix: 1
hw.snd.report_soft_formats: 1

My hw.usb settings:
Code:
Input:
# sysctl hw.usb

Output:
hw.usb.uaudio.debug: 0
hw.usb.uaudio.buffer_ms: 1
hw.usb.uaudio.default_channels: 0
hw.usb.uaudio.default_bits: 0
hw.usb.uaudio.default_rate: 0
hw.usb.uaudio.handle_hid: 1
hw.usb.cdce.interval: 0
hw.usb.cdce.debug: 0
hw.usb.ums.debug: 0
hw.usb.axge.debug: 0
hw.usb.wmt.timestamps: 0
hw.usb.wmt.debug: 0
hw.usb.uhid.debug: 0
hw.usb.usbhid.debug: 0
hw.usb.usbhid.enable: 0
hw.usb.ukbd.pollrate: 0
hw.usb.ukbd.no_leds: 0
hw.usb.ukbd.debug: 0
hw.usb.full_ddesc: 0
hw.usb.no_cs_fail: 0
hw.usb.proc.debug: 0
hw.usb.disable_port_power: 0
hw.usb.disable_enumeration: 0
hw.usb.power_timeout: 30
hw.usb.uhub.debug: 0
hw.usb.ugen.debug: 0
hw.usb.usb_lang_mask: 255
hw.usb.usb_lang_id: 9
hw.usb.template: -1
hw.usb.dev.debug: 0
hw.usb.timings.enum_nice_time: 16
hw.usb.timings.extra_power_up_time: 20
hw.usb.timings.resume_recovery: 50
hw.usb.timings.resume_wait: 50
hw.usb.timings.resume_delay: 250
hw.usb.timings.set_address_settle: 10
hw.usb.timings.port_resume_delay: 40
hw.usb.timings.port_powerup_delay: 300
hw.usb.timings.port_reset_recovery: 10
hw.usb.timings.port_root_reset_delay: 200
hw.usb.timings.port_reset_delay: 50
hw.usb.debug: 0
hw.usb.umass.throttle: 0
hw.usb.umass.debug: 0
hw.usb.no_shutdown_wait: 0
hw.usb.no_suspend_wait: 0
hw.usb.no_boot_wait: 0
hw.usb.ctrl.debug: 0
hw.usb.xhci.ctlstep: 0
hw.usb.xhci.dma32: 0
hw.usb.xhci.use_polling: 0
hw.usb.xhci.xhci_port_route: 0
hw.usb.xhci.debug: 0
hw.usb.xhci.dcepquirk: 0
hw.usb.xhci.ctlquirk: 1
hw.usb.xhci.streams: 0
hw.usb.uhci.loop: 0
hw.usb.uhci.debug: 0
hw.usb.ohci.debug: 0
hw.usb.ehci.lostintrbug: 0
hw.usb.ehci.iaadbug: 0
hw.usb.ehci.no_hs: 0
hw.usb.ehci.debug: 0

My USB DAC/AMP dev.pcm settings:
Code:
Input:
# sysctl dev.pcm.11

Output:
dev.pcm.11.feedback_rate: 96001
dev.pcm.11.mode: 3
dev.pcm.11.bitperfect: 1
dev.pcm.11.buffersize: 0
dev.pcm.11.play.vchans: 0
dev.pcm.11.hwvol_mixer: vol
dev.pcm.11.hwvol_step: 5
dev.pcm.11.%iommu:
dev.pcm.11.%parent: uaudio0
dev.pcm.11.%pnpinfo:
dev.pcm.11.%location:
dev.pcm.11.%driver: pcm
dev.pcm.11.%desc: GuangZhou FiiO Electronics Co.,Ltd FIIO K19

I guess I do not know what else I could try to get this audible clicks away...
Should I try a USB-C to USB-C cable or an HDMI cable ?
 
i had an issue with audio clicks

turned out i was missing gpu firmware
which on my system was

Code:
gpu-firmware-intel-kmod-kabylake-20230625

have a look at your dmseg output
and see if there are any errors about firmware not being found

Code:
sudo dmesg | grep firmware
 
Code:
Input:
# dmesg | grep firmware

Output:
iwlwifi0: successfully loaded firmware image 'iwlwifi-ty-a0-gf-a0-83.ucode'
iwl-debug-yoyo.bin: could not load binary firmware /boot/firmware/iwl-debug-yoyo.bin either
iwl-debug-yoyo.bin: could not load binary firmware /boot/firmware/iwl-debug-yoyo.bin either
iwl-debug-yoyo_bin: could not load binary firmware /boot/firmware/iwl-debug-yoyo_bin either
iwl_debug_yoyo_bin: could not load binary firmware /boot/firmware/iwl_debug_yoyo_bin either
iwlwifi0: loaded firmware version 83.e8f84e98.0 ty-a0-gf-a0-83.ucode op_mode iwlmvm
iwlwifi0: successfully loaded firmware image 'iwlwifi-ty-a0-gf-a0.pnvm'

Could the wifi firmware cause that clicks ?
Just a thought, but should eventually hw.snd.latency and hw.usb.uaudio.buffer_ms be set to an equal value ?
 
i have the same error as you

Code:
iwl-debug-yoyo.bin: could not load binary firmware /boot/firmware/iwl-debug-yoyo.bin either
iwl-debug-yoyo.bin: could not load binary firmware /boot/firmware/iwl-debug-yoyo.bin either
iwl-debug-yoyo_bin: could not load binary firmware /boot/firmware/iwl-debug-yoyo_bin either
iwl_debug_yoyo_bin: could not load binary firmware /boot/firmware/iwl_debug_yoyo_bin either
iwlwifi0: loaded firmware version 77.2df8986f.0 cc-a0-77.ucode op_mode iwlmvm

but i dont have any audio issues at the moment

i only had the audio clicks when i didnt have this package
on my dell xps 15 2019

Code:
gpu-firmware-intel-kmod-kabylake-20230625

i also have realtime enabled but i dont use it with mpd

do you get the issue if you dont start mpd with realtime
i would try starting mpd normally and see if you still get the same issue

i have noticed when you update mpd it overwrites the mpd rc.d file

Code:
/usr/local/etc/rc.d/musicpd

so if you have any custom options set in that file they get overwritten after an mpd update

this is my musicpd rc.d conf


Code:
#!/bin/sh

# PROVIDE: musicpd
# REQUIRE: mixer LOGIN avahi_daemon oss
# KEYWORD: shutdown

# Add the following line to /etc/rc.conf to enable mpd:
#
# musicpd_enable=YES

. /etc/rc.subr

name=musicpd
rcvar=musicpd_enable
desc="Music Player Daemon"

load_rc_config $name

: ${musicpd_enable:=NO}

command=/usr/local/bin/musicpd
command_args=/home/djwilcox/.config/mpd/mpd.conf
required_files=/home/djwilcox/.config/mpd/mpd.conf
start_precmd=${name}_getpidfile
stop_precmd=${name}_getpidfile

musicpd_getpidfile()
{
    if get_pidfile_from_conf pid_file /home/djwilcox/.config/mpd/mpd.conf ; then
        pidfile="$_pidfile_from_conf"
    else
        pidfile="/var/mpd/.mpd/pid"
    fi
}

run_rc_command $1

mpd config


Code:
# mpd config

music_directory        "/home/djwilcox/music"
playlist_directory    "/home/djwilcox/.config/mpd/playlists"
db_file            "/home/djwilcox/.config/mpd/mpd.db"
log_file        "/home/djwilcox/.config/mpd/mpd.log"
pid_file        "/home/djwilcox/.config/mpd/mpd.pid"
state_file        "/home/djwilcox/.config/mpd/mpdstate"
sticker_file        "/home/djwilcox/.config/mpd/sticker.sql"
user            "djwilcox"
group            "djwilcox"
bind_to_address        "/home/djwilcox/.config/mpd/socket"

input {
        plugin "curl"
}

audio_output {
    type        "oss"
    name        "My OSS Device"
#    device        "/dev/dsp"    # optional
    mixer_type      "hardware"    # optional
    mixer_device    "/dev/mixer"    # optional
#    mixer_control    "PCM"        # optional
    mixer_control    "vol"        # optional
}

mpd notes


root dotfiles


dotfiles

 
gpu-firmware-intel-kmod-kabylake-20230625
I assume that it is for the Intel CPUs internal GPU, right ?
I stopped buying Intel since Haswell so, I don't really know if it is for the iGPU or dGPU of Intel.

I have a Ryzen R9 9900X CPU so, should I get graphics/gpu-firmware-amd-kmod ?
My internal GPU as of now is still not supported by FreeBSD, but I guess just for avoiding audible clicks that could suffice.
However, I have nvidia-drm-kmod installed, too.
Do I need to blacklist one kmod so it doesn't bite the other ?
In Linux I know that I cannot have both kmod modules simultaneously loaded.

On a sidenote playing music through HDMI routed through the nvidia GPU does not exhibit any audible clicks, maybe trying out HDMI through the DAC/AMP will help, too.

do you get the issue if you dont start mpd with realtime
i would try starting mpd normally and see if you still get the same issue
No, I didn't, but it is worth trying out.

i have noticed when you update mpd it overwrites the mpd rc.d file

/usr/local/etc/rc.d/musicpd
so if you have any custom options set in that file they get overwritten after an mpd update
No, I have not custom options set in that file, but if the other suggestions don't work, I can try your rc.d/musicpd file, too in combination.
 
I assume that it is for the Intel CPUs internal GPU, right ?

yes that right
the dell xps 15 has intel and an nvidia gpu

I have a Ryzen R9 9900X CPU so, should I get graphics/gpu-firmware-amd-kmod ?
My internal GPU as of now is still not supported by FreeBSD, but I guess just for avoiding audible clicks that could suffice.
However, I have nvidia-drm-kmod installed, too.
Do I need to blacklist one kmod so it doesn't bite the other ?
In Linux I know that I cannot have both kmod modules simultaneously loaded.

im not sure about that

i know its a pain

but i would using try mpd without using realtime and the eq
and enable things one by one until you get the clicking

that way you should be able to find the cause of the problem

another thing that might be worth looking at is the audio sample rates
do you get the error with audio using 44.1khz or 48khz

its one of those bugs where you have to work through and eliminate things one by one
and go through all the possible permutations

also it might be worth comparing the dmesg output when you have the clicking
and when you dont

playing music through HDMI routed through the nvidia GPU does not exhibit any audible clicks

i would save the demsg ouput as files
when you have the clicking

Code:
sudo dmesg > dmesg-clicks

and when you dont have the clicking

Code:
sudo dmesg > dmesg-noclicks

and then use diff to compare the output of the 2 files from dmesg
might narrow down the issue
 
One question I forgot to ask, do you have both intel and nvidia drm-kmods enabled in /etc/rc.conf, and both drm.modesets enabled in /boot/loader.conf ?

i only have this in my kld_list in rc.conf

Code:
kld_list="nvidia-modeset nvidia-drm linux linux64 i915kms ext2fs mac_priority fusefs vmm nmdm"

and nothing for nvidia in my loader.conf

rc.conf


Code:
zfs_enable="YES"
clear_tmp_enable="YES"
syslogd_flags="-ss"
hostname="pollux"
local_unbound_enable="YES"
sshd_enable="NO"
moused_enable="NO"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
# pf firewall
pf_enable="YES"
# time and date
ntpd_enable="YES"
ntpd_sync_on_start="YES"
# power settings
powerd_enable="YES"
powerd_flags="-a hiadaptive -b adaptive"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"
# kld list
kld_list="nvidia-modeset nvidia-drm linux linux64 i915kms ext2fs mac_priority fusefs vmm nmdm"
# wayland
seatd_enable="YES"
# dbus
dbus_enable="YES"
# linux
linux_enable="YES"
ubuntu_enable="NO"
# virtual oss
virtual_oss_enable="YES"
virtual_oss_configs="dsp"
virtual_oss_dsp="-T /dev/sndstat -S -Q 0 -C 2 -c 2 -r 48000 -b 16 -s 1024 -P /dev/dsp1 -R /dev/null -w vdsp.wav -l dsp -t vdsp.ctl"
# sndiod audio
sndiod_enable="YES"
# jack
jackd_enable="NO"
jackd_user="djwilcox"
jackd_rtprio="YES"
# musicpd
musicpd_enable="YES"
# devfs rules for user mounting drives
devfs_system_ruleset="localrules"

# laggo failover device
# ethernet mac address set to wifi mac address
ifconfig_ue0="ether 78:2b:46:ee:27:a3"
wlans_iwlwifi0="wlan0"
ifconfig_wlan0="WPA"
create_args_wlan0="country GB"
cloned_interfaces="lagg0 lo1"
#cloned_interfaces="lagg0 lo1 bridge0 tap0"
#ifconfig_bridge0="up addm lagg0 addm tap0"
ifconfig_lagg0="up laggproto failover laggport ue0 laggport wlan0 DHCP"

# laggpf netif restart lagg0, and restart pf
# needed for usb exthernet and wifi
laggpf_enable="YES"

# ralink wifi
#wlans_run0="wlan0"
#ifconfig_wlan0="WPA SYNDHCP"
#dnscrypt_proxy_enable="YES"
#dnscrypt_proxy_pidfile="/var/run/dnscrypt-proxy.pid"
#dnscrypt_proxy_logfile="/var/log/dnscrypt-proxy.log"
# jail enable
jail_enable="YES"
ifconfig_lo1_aliases="inet 10.10.0.1-12/24"
#jail_parallel_start="YES"
#jail_list="classic"
# syncthing
syncthing_enable="NO"
syncthing_user="djwilcox"
syncthing_group="djwilcox"
# byhve
vm_enable="YES"
vm_dir="zfs:zroot/vm"
# gateway enable for bhyve
gateway_enable="YES"

loader.conf


Code:
aesni_load="YES"
geom_eli_load="YES"
security.bsd.allow_destructive_dtrace=0
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
# nvidia modeset
#hw.nvidiadrm.modeset="1"
# nullfs tmpfs for poudriere
nullfs_load="YES"
tmpfs_load="YES"
# audio
snd_hda_load="YES"
snd_uaudio_load="YES"
# coretemp
acpi_video_load="YES"
coretemp_load="YES"
# touchpad
wsp_load="YES"
# async i/o
aio_load="YES"
# cuse audio for virtual_oss
cuse_load="YES"
# virtual oss - start with: sudo sysrc onestart virtual_oss
virtual_oss_enable="NO"
# mixertui
sysctlinfo_load="YES"
sysctlbyname_improved_load="YES"
# usb keyboard multimedia keys
usbhid_load="YES"
# setfibs
net.fibs=2
#net.add_addr_allfibs=0
 
I have tried almost all of the methods suggested, and sadly the audible clicks do not vanish.
The only method I could not try is the graphics/gpu-firmware-amd-kmod one, because after building, installing, and loading the appropriate module I got a kernel crash dump due to my iGPU still not being supported on FreeBSD.

Luckily my DAC/AMP supports the setting HDMI in/Headphones out.
So, I bought today a HDMI cable, and am going to try it out tomorrow after it arrives.
Since my Nvidia GPU and its appropriate kmod modules are supported, I hope that there won't be any audible clicks to hear.

After testing things out tomorrow, I will reply again.
 
The cable arrived, and I tested the GPUs HDMI in/Headphones out option of my DAC/AMP.
After test listening for about one hour to 44.1KHz, 48KHz, and 96KHz flac files, I could not hear any audible clicks.
I can confirm that the gpu-firmware-*-kmod method works.
 
Back
Top