Digital output audio delayed and popping

Hello,

I’ve been experiencing an issue with my digital audio output (optical) having delays and popping when switching between audio from different sources. If I, for example, play some music through Spotify and then pause it and immediately play audio through Firefox, there will be a 1-2 second delay as well as a popping sound before the Firefox audio switches. The same occurs in the opposite direction. However, if I am already playing some sound through one of them and turn on the other while it’s playing then there is no delay or popping.

I originally thought that this may be caused by some form of powersaving since I had similar issues before with analog audio and commenting out load-module module-suspend-on-idle fixed it, but I cannot find a similar variable for specifically digital output. When I do try the steps listed above through analog outputs the issue does not occur and the audio switches properly.

My inxi output:

System:    Kernel: 5.10.13-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.1 Desktop: KDE Plasma 5.20.5 tk: Qt 5.15.2 
           wm: kwin_x11 dm: SDDM Distro: Manjaro Linux 
Machine:   Type: Desktop Mobo: MSI model: B150 GAMING M3 (MS-7978) v: 2.0 serial: <filter> UEFI: American Megatrends v: B.C0 
           date: 07/05/2018 
Memory:    RAM: total: 15.58 GiB used: 8.84 GiB (56.7%) 
           RAM Report: permissions: Unable to run dmidecode. Root privileges required. 
CPU:       Info: Quad Core model: Intel Core i7-6700K bits: 64 type: MT MCP arch: Skylake-S rev: 3 L2 cache: 8 MiB 
           bogomips: 64026 
           Speed: 4000 MHz min/max: 800/4200 MHz Core speeds (MHz): 1: 4000 2: 4000 3: 4000 4: 4000 5: 4000 6: 4000 7: 4000 
           8: 4000 
           Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat arch_perfmon art avx avx2 bmi1 bmi2 bts clflush 
           clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64 dtherm dts ept ept_ad erms est f16c 
           flexpriority flush_l1d fma fpu fsgsbase fxsr hle ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs ida intel_pt 
           invpcid invpcid_single lahf_lm lm mca mce md_clear mmx monitor movbe mpx msr mtrr nonstop_tsc nopl nx pae pat pbe 
           pcid pclmulqdq pdcm pdpe1gb pebs pge pln pni popcnt pse pse36 pti pts rdrand rdseed rdtscp rep_good rtm sdbg sep 
           smap smep ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer 
           vme vmx vnmi vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr 
Graphics:  Device-1: NVIDIA GP102 [GeForce GTX 1080 Ti] vendor: Micro-Star MSI driver: nvidia v: 460.39 bus ID: 01:00.0 
           chip ID: 10de:1b06 class ID: 0300 
           Display: x11 server: X.Org 1.20.10 compositor: kwin_x11 driver: loaded: nvidia resolution: 1: 1920x1080~60Hz 
           2: 1920x1080 s-dpi: 92 
           OpenGL: renderer: GeForce GTX 1080 Ti/PCIe/SSE2 v: 4.6.0 NVIDIA 460.39 direct render: Yes 
Audio:     Device-1: NVIDIA GP102 HDMI Audio vendor: Micro-Star MSI driver: N/A bus ID: 01:00.1 chip ID: 10de:10ef 
           class ID: 0403 
           Device-2: ASUSTek Xonar SoundCard type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 3-1:2 
           chip ID: 0b05:189d class ID: 0300 
           Device-3: Logitech Webcam C260 type: USB driver: snd-usb-audio,uvcvideo bus ID: 1-9:4 chip ID: 046d:081a 
           class ID: 0102 serial: <filter> 
           Sound Server: ALSA v: k5.10.13-1-MANJARO 
Network:   Device-1: Qualcomm Atheros Killer E2400 Gigabit Ethernet vendor: Micro-Star MSI driver: alx v: kernel port: d000 
           bus ID: 06:00.0 chip ID: 1969:e0a1 class ID: 0200 
           IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           IP v4: <filter> type: dynamic noprefixroute scope: global broadcast: <filter> 
           IF-ID-1: vpn0 state: down mac: N/A 
           WAN IP: <filter> 
Bluetooth: Device-1: Broadcom BCM20702A0 Bluetooth 4.0 type: USB driver: btusb v: 0.8 bus ID: 1-4:3 chip ID: 0a5c:21ec 
           class ID: fe01 serial: <filter> 
           Message: Required tool hciconfig not installed. Check --recommends 
RAID:      Message: No RAID data was found. 
Drives:    Local Storage: total: 5.1 TiB used: 2.89 TiB (56.7%) 
           ID-1: /dev/sda vendor: Western Digital model: WD40EFRX-68N32N0 size: 3.64 TiB speed: 3.0 Gb/s rotation: 5400 rpm 
           serial: <filter> rev: 0A82 scheme: GPT 
           ID-2: /dev/sdb vendor: Kingston model: SV300S37A240G size: 223.57 GiB speed: 6.0 Gb/s rotation: SSD 
           serial: <filter> rev: BBF0 scheme: MBR 
           ID-3: /dev/sdc vendor: SanDisk model: SDSSDX120GG25 size: 111.79 GiB speed: 6.0 Gb/s rotation: SSD serial: <filter> 
           rev: R211 scheme: MBR 
           ID-4: /dev/sdd vendor: Western Digital model: WD2500AAJS-65B4A0 size: 232.89 GiB speed: 3.0 Gb/s serial: <filter> 
           rev: 3A01 scheme: MBR 
           ID-5: /dev/sde type: USB model: External USB3.0 size: 931.51 GiB serial: <filter> rev: 0204 scheme: GPT 
           Message: No Optical or Floppy data was found. 
Partition: ID-1: / size: 71.72 GiB used: 43.95 GiB (61.3%) fs: ext4 dev: /dev/sdb5 label: N/A 
           uuid: 6dfd4fdc-582f-4878-88f8-656d00f01914 
           ID-2: /boot/efi size: 187.1 MiB used: 258 KiB (0.1%) fs: vfat dev: /dev/sdb1 label: N/A uuid: A76D-A466 
           ID-3: /home size: 109.37 GiB used: 49.68 GiB (45.4%) fs: ext4 dev: /dev/sdb6 label: N/A 
           uuid: 53ef7ac4-7e58-404e-9a02-8eddbf1c597a 
           ID-4: /run/media/user/External_Backup size: 915.89 GiB used: 409.33 GiB (44.7%) fs: ext4 dev: /dev/sde1 
           label: External_Backup uuid: cbbc5bd6-8ac2-4776-bcfc-4de42b0bd56a 
           ID-5: /run/media/user/Games size: 109.53 GiB used: 75.24 GiB (68.7%) fs: ext4 dev: /dev/sdc1 label: Games 
           uuid: 71f92776-5d8e-4738-8a3c-2080820f5861 
           ID-6: /run/media/user/Music size: 228.23 GiB used: 14.57 GiB (6.4%) fs: ext4 dev: /dev/sdd1 label: Music 
           uuid: 2ed0e1c7-a49f-46c3-a9c6-2f5d5f17e4a4 
           ID-7: /run/media/user/Space size: 3.58 TiB used: 2.31 TiB (64.6%) fs: ext4 dev: /dev/sda1 label: Space 
           uuid: 92be51ee-0950-4e96-899b-589806627556 
           ID-8: /run/timeshift/backup raw size: 3.64 TiB size: <superuser required> used: <superuser required> fs: ext4 
           dev: /dev/sda1 label: Space uuid: 92be51ee-0950-4e96-899b-589806627556 
Swap:      ID-1: swap-1 type: file size: 8 GiB used: 5.94 GiB (74.3%) priority: -2 file: /swapfile 
Unmounted: ID-1: /dev/sdb4 size: 1 KiB fs: <superuser required> label: N/A uuid: N/A 
USB:       Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 12 rev: 2.0 speed: 480 Mb/s chip ID: 1d6b:0002 class ID: 0900 
           Device-1: 1-2:2 info: Logitech G403 Prodigy Gaming Mouse type: Mouse,HID driver: hid-generic,usbhid interfaces: 2 
           rev: 2.0 speed: 12 Mb/s chip ID: 046d:c083 class ID: 0300 serial: <filter> 
           Device-2: 1-4:3 info: Broadcom BCM20702A0 Bluetooth 4.0 type: Bluetooth driver: btusb interfaces: 4 rev: 2.0 
           speed: 12 Mb/s chip ID: 0a5c:21ec class ID: fe01 serial: <filter> 
           Device-3: 1-9:4 info: Logitech Webcam C260 type: Video,Audio driver: snd-usb-audio,uvcvideo interfaces: 4 rev: 2.0 
           speed: 480 Mb/s chip ID: 046d:081a class ID: 0102 serial: <filter> 
           Device-4: 1-11:5 info: Corsair Vengeance K70R keyboard type: Keyboard,HID driver: corsair,usbhid interfaces: 3 
           rev: 2.0 speed: 12 Mb/s chip ID: 1b1c:1b09 class ID: 0300 
           Hub-2: 2-0:1 info: Full speed (or root) Hub ports: 6 rev: 3.0 speed: 5 Gb/s chip ID: 1d6b:0003 class ID: 0900 
           Device-1: 2-5:2 info: JMicron / JMicron USA JMS578 SATA 6Gb/s type: Mass Storage driver: uas interfaces: 1 rev: 3.0 
           speed: 5 Gb/s chip ID: 152d:0578 class ID: 0806 serial: <filter> 
           Hub-3: 3-0:1 info: Full speed (or root) Hub ports: 2 rev: 2.0 speed: 480 Mb/s chip ID: 1d6b:0002 class ID: 0900 
           Device-1: 3-1:2 info: ASUSTek Xonar SoundCard type: Audio,HID driver: hid-generic,snd-usb-audio,usbhid 
           interfaces: 7 rev: 2.0 speed: 480 Mb/s chip ID: 0b05:189d class ID: 0300 
           Hub-4: 4-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.0 speed: 5 Gb/s chip ID: 1d6b:0003 class ID: 0900 
Sensors:   System Temperatures: cpu: 42.5 C mobo: 37.0 C gpu: nvidia temp: 59 C 
           Fan Speeds (RPM): cpu: 3802 fan-2: 516 fan-3: 1243 fan-4: 0 fan-5: 842 gpu: nvidia fan: 0% 
Info:      Processes: 350 Uptime: 7d 11h 14m wakeups: 24 Init: systemd v: 247 Compilers: gcc: 10.2.0 Packages: 1717 
           pacman: 1702 flatpak: 15 Shell: Bash v: 5.1.0 running in: yakuake inxi: 3.3.01 

The device that I’m currently using is the ASUSTek Xonar SoundCard type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 3-1:2 but I experienced the same issue using the optical audio output in my motherboard.

Any suggestions are appreciated. Thanks.