Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

This subforum contains all the issues which we already resolved.
cpw
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by cpw »

I'm not even 100% sure if this is a game bug or not, but it's been absolutely repeatable for loading the game from steam. IF I have another audio source playing (YouTube, twitch, whatever) when the game starts up, the Factorio music will start playing in a very choppy manner, and audio is persistently "broken and choppy" from there on. If I do NOT have another audio source playing, the Factorio game audio is fine, and I can resume playing whatever other audio source as soon as that familiar game starting chime has occurred.

This has only started happening since the 2.0 update, but sadly there is a confounding factor - I upgraded my computer at the same time as 2.0 released, and so it's difficult to absolutely tie it to the 2.0 update, it could easily be something weird about the new computer hardware (though the OS is literally the same from before and after, and nothing else in the OS is complaining).

Metadata:
OS: Debian unstable/sid updated regularly.
Hardware: 9950x and 7900xtx. Audio is actually a USB audio device, split into multiple virtual devices using pipewire, game is configured to use pipewire.
Desktop Env is the dreaded gnome 3 (sorry!) but running on the X11 backend (I was until recently an NVIDIA user)

Attached are two factorio logs - previous had the audio glitch, current did not (I muted other audio sources prior to starting the game for that run as noted above). I do not see any significant difference between them.
Attachments
factorio-current.log
(7.07 KiB) Downloaded 13 times
factorio-previous.log
(7.16 KiB) Downloaded 13 times
Donion
Factorio Staff
Factorio Staff
Posts: 326
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Donion »

Would it be possible for you to try not splitting into virtual devices as a sanity check?
cpw
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by cpw »

Not easily. I would have to rejig my audio setup to use a different device or completely rebuild my audio mappings - it uses a bunch of stream remapping logic to map audio from inputs to outputs (it's a Focusrite mixer).

It should be noted this was working perfectly for 1.1 Factorio, and has been working consistently for a variety of other games for years now. I would be surprised if this suddenly became an issue, just for 2.0.
cpw
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by cpw »

Just to sanity check, I just fired up a bunch of games to see if any would have this issue. None did. Some were linux native games as well (shapez2), as well as a bunch running through proton. It seems very specific to Factorio 2.0.
Donion
Factorio Staff
Factorio Staff
Posts: 326
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Donion »

Fair enough.

Unless you were using Allegro in 1.1 instead of the default SDL I'm not sure what could be the cause. Except using a newer version of SDL, nothing really changed in the way we open audio.
Donion
Factorio Staff
Factorio Staff
Posts: 326
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Donion »

What is the output format you're using with your audio interface?
cpw
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by cpw »

It's just 44.1kHz PCM 2 channel audio, as the log file notes, I believe. It looks like I've been using the SDL backend for a while, I just reviewed some old log files from backups from long ago, and they show this.

Code: Select all

   0.150 [Audio] Backend:SDL(default); Driver:pulseaudio, Device:Default device, Depth:16, Channels:2, Frequency:44100
OK. The problem is setting "pipewire" in the UI. I've just done a bunch of launches, and if I leave it at the default of "pulseaudio" it seems to repeatedly load fine, and I can use the device redirects without problem. If I set it to "pipewire" it's glitchy and broken, even though pulseaudio is just using pipewire. Fascinating.

Note: the whole "driver" thing wasn't an option in 1.1 from what I recall, so I guess that's where to look.
Donion
Factorio Staff
Factorio Staff
Posts: 326
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Donion »

Huh, strange. One would guess using pipewire driver when using pipewire would work better.
Yes, the driver selection in Settings is new, it's just exposing the SDL_AUDIODRIVER variable/hint.
Well, as long as you have a working solution, I'm happy with that. We'll be updating our SDL soon so maybe it will fix your issue as well.
User avatar
Ober3550
Inserter
Inserter
Posts: 32
Joined: Sun Jan 15, 2017 9:01 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Ober3550 »

I'm also having audio artifacts with the latest version. I thought it was my headphones/some weird interaction with OBS but it comes through on recorded audio clips too. I can upload a clip for you if you need
User avatar
Ober3550
Inserter
Inserter
Posts: 32
Joined: Sun Jan 15, 2017 9:01 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Ober3550 »

I've uploaded a clip of sound of a mining drill running but you'll notice after a few seconds there's weird audio artifacts where it's presumably trying to drop the gain on certain elements or mixing it incorrectly. https://youtu.be/UGf3YhLfKmI
Donion
Factorio Staff
Factorio Staff
Posts: 326
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Donion »

Ober3550 wrote: Sat Nov 02, 2024 6:23 am I've uploaded a clip of sound of a mining drill running but you'll notice after a few seconds there's weird audio artifacts where it's presumably trying to drop the gain on certain elements or mixing it incorrectly. https://youtu.be/UGf3YhLfKmI
I can't hear anything wrong in the clip. In any case this is not the same, so if you're having issues, please make a new topic and provide more information.
vadcx
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Fri Apr 19, 2024 4:12 pm
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by vadcx »

side note: CS2 had audio issues for a long time on Linux, where the audio output buffer would keep filling up and accumulating latency. Resetting the audio output in the game helped or setting pipewire frequency to 44100:
https://github.com/ValveSoftware/csgo-o ... 1817424175

Though if you asked me, we should transition to a 48kHz Opus world (4/8kHz steps) to avoid compute intensive resampling as much as possible.
Donion
Factorio Staff
Factorio Staff
Posts: 326
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Donion »

vadcx wrote: Sat Nov 02, 2024 9:57 am Though if you asked me, we should transition to a 48kHz Opus world (4/8kHz steps) to avoid compute intensive resampling as much as possible.
I will be bringing support for Opus soon. The main goal is to reduce the size of audio data on disk. I'm not sure at the moment if we will fully switch to 48kHz.
User avatar
Ober3550
Inserter
Inserter
Posts: 32
Joined: Sun Jan 15, 2017 9:01 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Ober3550 »

Donion wrote: Sat Nov 02, 2024 9:52 am
Ober3550 wrote: Sat Nov 02, 2024 6:23 am I've uploaded a clip of sound of a mining drill running but you'll notice after a few seconds there's weird audio artifacts where it's presumably trying to drop the gain on certain elements or mixing it incorrectly. https://youtu.be/UGf3YhLfKmI
I can't hear anything wrong in the clip. In any case this is not the same, so if you're having issues, please make a new topic and provide more information.
I just tried listening to the clip on a different device and it sounds fine. So my headphones are dodgy
Donion
Factorio Staff
Factorio Staff
Posts: 326
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: Weird glitchy audio when other audio source playing at start since 2.0 on Linux?

Post by Donion »

I'm gonna move this to resolved and chalk it up to Linux audio drivers oddities.
Post Reply

Return to “Resolved Problems and Bugs”