Civ 6 audio problem

I have installed the linux native version of Civ 6 in steam, with the launch option:

LD_PRELOAD=/usr/lib/libfreetype.so.6 %command%

it runs fine. However i’m having an odd problem with sound. I’ll just have to describe what happens because i’ve no idea whats going on technically speaking.

So when the game launches and the splash screen comes up I hear a small static burst in the right ear (heaphones), that incidentally is the same sound i hear if i restart pulseaudio. Then the audio from the game comes through in bursts, so there will be several second of silence, then a few seconds of game audio.

The really odd thing is that if I have other sound playing in the system when I launch the game, say a youtube video, then it seems to work flawlessly, once the game has started I can stop the video then the game audio will behave normally.

The only similar experience i’ve had to this was a sort of buffer problem when I had too few fragments set, but the audio for the rest of the system seems fine, even other games.

Any ideas?

I’m running manjaro-xfce with the standard alsa/pulseaudio. I’m using the built-in intel/realtek sound chip on my motherboard (Asus). I’m exclusively using the toslink out so my sink is IEC958 output.

As its toslink I have some defaults overriden in ~/.config/daemon.conf

high-priority = yes
nice-level = -11

realtime-scheduling = yes
realtime-priority = 9

resample-method = speex-float-5

flat-volumes = no

default-sample-format = s16le
default-sample-rate = 44100

default-sample-channels = 2
default-channel-map = front-left,front-right

default-fragments = 4
default-fragment-size-msec = 15
[jamie@manjaro-rig ~]$ inxi -A
Audio:
  Device-1: Intel 100 Series/C230 Series Family HD Audio 
  driver: snd_hda_intel 
  Device-2: NVIDIA GP104 High Definition Audio driver: snd_hda_intel 
  Sound Server-1: ALSA v: k5.13.13-1-MANJARO running: yes 
  Sound Server-2: PulseAudio v: 15.0 running: yes 
[jamie@manjaro-rig ~]$ aplay -l | grep -A2 Intel 
card 0: PCH [HDA Intel PCH], device 0: ALC1150 Analog [ALC1150 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1150 Digital [ALC1150 Digital]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

[jamie@manjaro-rig ~]$ sudo lspci -v | grep -B1 -A12 -i audio
[sudo] password for jamie: 

00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
	Subsystem: ASUSTeK Computer Inc. Device 8691
	Flags: bus master, fast devsel, latency 32, IRQ 147
	Memory at df940000 (64-bit, non-prefetchable) [size=16K]
	Memory at df920000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: [50] Power Management version 3
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel

00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset Family SMBus (rev 31)
	Subsystem: ASUSTeK Computer Inc. Device 8694
	Flags: medium devsel, IRQ 16
--

01:00.1 Audio device: NVIDIA Corporation GP104 High Definition Audio Controller (rev a1)
	Subsystem: NVIDIA Corporation Device 1b80
	Flags: bus master, fast devsel, latency 0, IRQ 17
	Memory at df080000 (32-bit, non-prefetchable) [size=16K]
	Capabilities: [60] Power Management version 3
	Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [78] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel

02:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 (rev 01) (prog-if 02 [NVM Express])
	Subsystem: Samsung Electronics Co Ltd PM963 2.5" NVMe PCIe SSD

[jamie@manjaro-rig ~]$ sudo lshw | grep -B4 -A10 -i audio
                capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
                configuration: driver=nvidia latency=0
                resources: irq:149 memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:c0000-dffff
           *-multimedia
                description: Audio device
                product: GP104 High Definition Audio Controller
                vendor: NVIDIA Corporation
                physical id: 0.1
                bus info: pci@0000:01:00.1
                version: a1
                width: 32 bits
                clock: 33MHz
                capabilities: pm msi pciexpress bus_master cap_list
                configuration: driver=snd_hda_intel latency=0
                resources: irq:17 memory:df080000-df083fff
        *-usb
--
             clock: 33MHz (30.3ns)
             configuration: latency=0
             resources: memory:df944000-df947fff
        *-multimedia
             description: Audio device
             product: 100 Series/C230 Series Chipset Family HD Audio Controller
             vendor: Intel Corporation
             physical id: 1f.3
             bus info: pci@0000:00:1f.3
             version: 31
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi bus_master cap_list
             configuration: driver=snd_hda_intel latency=32
             resources: irq:147 memory:df940000-df943fff memory:df920000-df92ffff
        *-serial

Oh I should mention, i’ve looked though the Arch guide for pulseaudio troubleshooting

https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Laggy_sound

and the specific game notes:

https://wiki.archlinux.org/title/Steam/Game-specific_troubleshooting#Civilization_VI

The linux version of Civ 6 could be considered abandoned since Aspyr who ported it just don’t keep it updated. The advice I’ve heard is to just use the windows version under proton as this runs a whole lot better.

Probably not the advice you wanted though…

Also I’ve had this issue before. I had something similar with mumble where the issue was the sound buffer was too small. You can over-ride with an environmental variable option to set pulse to PULSE_LATENCY_MSEC=60

Here’s something to peek at. https://gaming.stackexchange.com/questions/375912/how-to-stop-wine-games-from-popping-through-pulse-alsa-steam-edition

Doesn’t this option only really work on RT kernels? Are you using one? You might want to try disabling this if you don’t.

I think the default sample format and rate are both actually set to default for you btw so no need to include them.

Somewhere in the pulseaudio configi s a setting for ‘avoid-resampling’ I suggest you try setting that to ‘yes’.

default-fragments = 4
default-fragment-size-msec = 15

This setting might also be affecting your issue, try commenting this out to reset it to defaults and restart then try running the game again with that set to default instead of what you have it set to now.

If none of the above work. Try manually setting the latency

PULSEAUDIO_LATENCY_MSEC=60 %command%

Assuming you’re using steam launch commands.

The bursts you speak of are probably either what’s usually referred to as crackling or popping btw.

A common tweak for soundcards that have issues with that is to set tsched=0 (do a websearch for the exact setting, I don’t remember and cba to find it)

You may wanna try that setting as well, but if it doesn’t help I would suggest turning it off since some soundcards really struggle when tsched is on, other cards really struggle when it’s off (I think that’s mostly just old soundcards though).

Yeah thanks for the response. I kinda gathered the port wasn’t getting great support, that often seems to be the case with linux ports. However I haven’t come across accounts of other people having this issue, so i’m assuming its something to do with my setup.

Plus I should have mentioned, i’m getting the same problem with proton. I tried the steam linux runtime, and proton 6.3-6 I would have experimented a bit more but it seems to download the whole game again every time you switch.

@rabcor the reason for the overrides on scheduling and fragments is that I get sound break up and distortion without them, I think the issue is that i’m using toslink out, its a bit particular about what its fed. You might be on to something with RT kernel though, I have another manjaro system which I configured for realtime audio with a high priority audio usergroup, but i did that for a jack setup and i’m not using jack on this machine. I did try ‘avoid-resampling’ but that didn’t help.

I do also have tsched=0 in the ~/.config/pulse/default.pa

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
#Jamie added tsched=0 parameter
load-module module-udev-detect tsched=0
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

I’ll give the

PULSEAUDIO_LATENCY_MSEC=60 %command%

launch command a go

edit: nope, the launch command didn’t help unfortunately.

Ok I tried renaming my ~/.config/pulse/daemon.conf to deactivate my overrides, and restarted pulse with

pulseaudio -k
systemctl --user restart pulseaudio.service

That didn’t make any difference. So I don’t think my overrides are causing the problem.

I fished this out of the journal, don’t know if any of it is relevant but the timings match up with trying to launch the game:

[jamie@manjaro-rig ~]$ journalctl | grep audio | tail
Sep 15 21:17:00 manjaro-rig pulseaudio[7129]: ALSA woke us up to write new data to the device, but there was actually nothing to write.
Sep 15 21:17:00 manjaro-rig pulseaudio[7129]: Most likely this is a bug in the ALSA driver 'snd_hda_intel'. Please report this issue to the ALSA developers.
Sep 15 21:17:00 manjaro-rig pulseaudio[7129]: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
Sep 16 00:26:43 manjaro-rig systemd[753]: pulseaudio.service: Consumed 2min 21.381s CPU time.
Sep 16 00:26:44 manjaro-rig pulseaudio[12392]: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration.
Sep 16 00:26:56 manjaro-rig pulseaudio[12405]: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration.
Sep 16 00:27:00 manjaro-rig pulseaudio[12413]: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration.
Sep 16 00:27:35 manjaro-rig pulseaudio[12413]: ALSA woke us up to write new data to the device, but there was actually nothing to write.
Sep 16 00:27:35 manjaro-rig pulseaudio[12413]: Most likely this is a bug in the ALSA driver 'snd_hda_intel'. Please report this issue to the ALSA developers.
Sep 16 00:27:35 manjaro-rig pulseaudio[12413]: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.

my sink information, just for completeness:

[jamie@manjaro-rig ~]$ pactl list sinks
Sink #0
	State: IDLE
	Name: alsa_output.pci-0000_00_1f.3.iec958-stereo
	Description: Built-in Audio Digital Stereo (IEC958)
	Driver: module-alsa-card.c
	Sample Specification: s16le 2ch 48000Hz
	Channel Map: front-left,front-right
	Owner Module: 6
	Mute: no
	Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	Base Volume: 65536 / 100% / 0.00 dB
	Monitor Source: alsa_output.pci-0000_00_1f.3.iec958-stereo.monitor
	Latency: 92136 usec, configured 99954 usec
	Flags: HARDWARE HW_MUTE_CTRL DECIBEL_VOLUME LATENCY SET_FORMATS 
	Properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "ALC1150 Digital"
		alsa.id = "ALC1150 Digital"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "1"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xdf940000 irq 147"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1f.3"
		sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "a170"
		device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
		device.form_factor = "internal"
		device.string = "iec958:0"
		device.buffering.buffer_size = "17632"
		device.buffering.fragment_size = "4408"
		device.access_mode = "mmap"
		device.profile.name = "iec958-stereo"
		device.profile.description = "Digital Stereo (IEC958)"
		device.description = "Built-in Audio Digital Stereo (IEC958)"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	Ports:
		iec958-stereo-output: Digital Output (S/PDIF) (type: SPDIF, priority: 0, availability unknown)
	Active Port: iec958-stereo-output
	Formats:
		pcm

I initially posted in the gaming section, but its become obvious the issue i’m experiencing is not related to the game, but to sound in my system in general.

I’m using my onboard audio with toslink out, this is my sink:

[jamie@manjaro-rig ~]$ pactl list sinks
Sink #0
	State: IDLE
	Name: alsa_output.pci-0000_00_1f.3.iec958-stereo
	Description: Built-in Audio Digital Stereo (IEC958)
	Driver: module-alsa-card.c
	Sample Specification: s16le 2ch 44100Hz
	Channel Map: front-left,front-right
	Owner Module: 6
	Mute: no
	Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	Base Volume: 65536 / 100% / 0.00 dB
	Monitor Source: alsa_output.pci-0000_00_1f.3.iec958-stereo.monitor
	Latency: 10882 usec, configured 9977 usec
	Flags: HARDWARE HW_MUTE_CTRL DECIBEL_VOLUME LATENCY SET_FORMATS 
	Properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "ALC1150 Digital"
		alsa.id = "ALC1150 Digital"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "1"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xdf940000 irq 147"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1f.3"
		sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "a170"
		device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
		device.form_factor = "internal"
		device.string = "iec958:0"
		device.buffering.buffer_size = "1760"
		device.buffering.fragment_size = "352"
		device.access_mode = "mmap"
		device.profile.name = "iec958-stereo"
		device.profile.description = "Digital Stereo (IEC958)"
		device.description = "Built-in Audio Digital Stereo (IEC958)"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	Ports:
		iec958-stereo-output: Digital Output (S/PDIF) (type: SPDIF, priority: 0, availability unknown)
	Active Port: iec958-stereo-output
	Formats:
		pcm

and the problem, i’ve discovered after some testing is related to sample rates. Audio works perfectly at 44100Hz but as soon as something puts out 48000Hz audio it breaks.

What happens when it tries to play 48000Hz is always the same, first pulseaudio seems to crash, second it behaves in a very laggy way, several seconds of silence, then a couple of seconds of distorted audio, repeat.

I can reproduce this on demand with these test files, the 44.1K file plays perfectly but the 48K file always produces the described behaviour. (warning, the samples use a LOUD frequency sweep)

I used this command to monitor the sample rate in the sink whilst playing different audio

watch -n 1 'pactl list sinks | grep Sample'

This allows me to see, in near real time, when the sink switches sample rate. And without fail when it switches to 48k the sound breaks.

Civ 6, the game I was having trouble with defaults to 48k, however if you’re already playing 44.1k audio when you launch the game it uses 44.1k, or at least pulseaudio is resampling to 44.1k.

So thats an outline of the problem, 48k basically does not work. How can i fix this? is there some way I can force pulseaudio to always resample to 44.1k? or is there some way I can make 48K work without breaking?

I am aware that toslink is a 44.1k specification, so that may be at the root of the issue, but for reasons I don’t need to get into here, I have to use toslink out.

Edit: FYI for anyone interested, I gave up trying to solve this in pulseaudio. I’ve installed jack and am routing the pulseaudio sink through jack to the sound device. Not really the solution i’d prefer but it works.

:+1: Thank you for sharing! :+1:

However, could you do me a favour and:

  • edit your last post by pressing the 3 dots and the pencil icon
  • cut and paste the EDIT into a reply to your own question
  • click the 3 dots below your own answer to mark a solution like this:
    Solution
    so that the next person that has the exact same problem you just had will benefit from your post as your question will now be in the “solved” status.

:crossed_fingers: