Skip to content

Instantly share code, notes, and snippets.

@arainko
Last active December 31, 2025 02:00
Show Gist options
  • Select an option

  • Save arainko/ae95836dc9e636275a9f103aaacdb4f2 to your computer and use it in GitHub Desktop.

Select an option

Save arainko/ae95836dc9e636275a9f103aaacdb4f2 to your computer and use it in GitHub Desktop.
Fix CS2 audio issues on Linux (pop_os in particular)

Issue: playing CS2 and talking on Discord is impossible - the game audio cuts off after a certain time and never comes back.

Solution: Create a virtual device using some pipewire trickery and then use that virtual device as the output device in CS2.

  1. Save output of pactl list to a file (get this package installed if you don't have it)
  2. Search for Sink with State: RUNNING in the file we created in the previous point, in my case it looked like this:
Sink #52
	State: RUNNING
	Name: alsa_output.pci-0000_00_1f.3.analog-stereo
	Description: Built-in Audio Analog Stereo
	Driver: PipeWire
	Sample Specification: s32le 2ch 44100Hz
	Channel Map: front-left,front-right
	Owner Module: 4294967295
	Mute: no
	Volume: front-left: 35482 /  54% / -15.99 dB,   front-right: 35482 /  54% / -15.99 dB
	        balance 0.00
	Base Volume: 65536 / 100% / 0.00 dB
	Monitor Source: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.class = "generic"
		alsa.device = "0"
		alsa.driver_name = "snd_hda_intel"
		alsa.id = "ALC892 Analog"
		alsa.long_card_name = "HDA Intel PCH at 0xdf340000 irq 136"
		alsa.name = "ALC892 Analog"
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "HDA Intel PCH at 0xdf340000 irq 136"
		api.alsa.card.name = "HDA Intel PCH"
		api.alsa.path = "front:0"
		api.alsa.pcm.card = "0"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "8"
		device.api = "alsa"
		device.class = "sound"
		device.id = "47"
		device.profile.description = "Analog Stereo"
		device.profile.name = "analog-stereo"
		device.routes = "2"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Built-in Audio"
		node.name = "alsa_output.pci-0000_00_1f.3.analog-stereo"
		node.nick = "ALC892 Analog"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:0:front:0:playback"
		priority.driver = "1009"
		priority.session = "1009"
		factory.id = "18"
		clock.quantum-limit = "8192"
		client.id = "35"
		node.driver = "true"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "51"
		object.serial = "52"
		node.max-latency = "16384/44100"
		api.alsa.period-size = "1024"
		api.alsa.period-num = "32"
		api.alsa.headroom = "0"
		api.acp.auto-port = "false"
		api.acp.auto-profile = "false"
		api.alsa.card = "0"
		api.alsa.use-acp = "true"
		api.dbus.ReserveDevice1 = "Audio0"
		device.bus = "pci"
		device.bus_path = "pci-0000:00:1f.3"
		device.enum.api = "udev"
		device.form_factor = "internal"
		device.icon_name = "audio-card-analog-pci"
		device.name = "alsa_card.pci-0000_00_1f.3"
		device.nick = "HDA Intel PCH"
		device.plugged.usec = "15614161"
		device.product.id = "0xa170"
		device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
		device.subsystem = "sound"
		sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
		device.vendor.id = "0x8086"
		device.vendor.name = "Intel Corporation"
		device.string = "0"
	Ports:
		analog-output-lineout: Line Out (type: Line, priority: 9000, availability group: Legacy 4, available)
		analog-output-headphones: Headphones (type: Headphones, priority: 9900, availability group: Legacy 5, not available)
	Active Port: analog-output-lineout
	Formats:
		pcm
  1. Create a file with this name and under this directory: ~/.config/pipewire/pipewire.conf.d/pwsink.conf (the filename itself can be whatever)
  2. Note down the node.name field from the sink description (in my case it's alsa_output.pci-0000_00_1f.3.analog-stereo)
  3. Paste this into the file we created in point 3:
context.modules = [
    {   name = libpipewire-module-loopback
        args = {
            node.description = "FF Speakers"
            capture.props = {
                node.name = "FF_Speakers"
                media.class = "Audio/Sink"
                audio.position = [ FL FR ]
            }
            playback.props = {
                node.name = "playback.FF_Speakers"
                audio.position = [ AUX0 AUX1 ]
                target.object = "alsa_output.pci-0000_00_1f.3.analog-stereo"
                stream.dont-remix = true
                node.passive = true
            }
        }
    }
]

(we used the noted down node.name as the value of playback.props.target.object, node.name and node.description of both capture.props and playback.props can PROBABLY be arbitrary)

  1. Run systemctl --user restart pipewire, start up CS2 and select FF Speakers in the audio menu. Everything should be working just fine from now on.

Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment