Page 1 of 1

[Solved] Sound and music distortion [Linux]

Posted: Mon Mar 14, 2016 4:18 pm
by zvezdaburya
Sound and music in game is distorted for me, and also affects teamspeak chat if I use that and factorio at the same time. I am not sure what the cause can be. Sometimes i get the same bug when playing warthunder, but it usually goes away after a few matches, and does not affect teamspeak. Very strange...

Re: Sound and music distortion [Linux]

Posted: Mon Mar 14, 2016 4:25 pm
by sillyfly
Could you try the solution (second to last topic) here?

Could be related, although when I had this delay problem there was no audible distortion.

Re: Sound and music distortion [Linux]

Posted: Mon Mar 14, 2016 5:21 pm
by zvezdaburya
sillyfly wrote:Could you try the solution (second to last topic) here?

Could be related, although when I had this delay problem there was no audible distortion.
Did not work for me, but I might have done something wrong? I created the file in /etc/ and tried launching the game from terminal with padsp but sound would not play at all, just got a error message.

Edit: just tried launching the game with spotify playing music. The instant factorio starts loading, the music gets distorted.

Edit: Playing individual files straight from the factorio directory works without problems using VLC media player.

Edit: Tried launching the game again with spotify playing, distortion started as soon as the game started loading, but stopped before reaching main menu. Loaded a save, stopped spotify, and could play without sound distortion. Will try this a few more times..

Edit: No luck, have tried multiple more times to start the game, with and without spotify playing, reboot etc.. distortion still happens.

Edit: Fixed it.

From Askubuntu.com I found this tip through a google search:
This one helped me: [Static and crackling in my HDMI audio?]: Static and crackling in my HDMI audio?

edit

/etc/pulse/default.pa

look for

load-module module-udev-detect

add tsched=0

load-module module-udev-detect tsched=0

reboot
I have no idea what the tsched=0 does, but I have tried launching Factorio multiple times now, with and without spotify, and there is no distortion anymore.

From arclinux forums:
tsched=0 disables PulseAudio's timer-based scheduling and uses the classic interrupt-driven approach. Timer-based scheduling allows for better latency management and reduced CPU usage. It puts very strict requirements on the ALSA drivers. Unfortunately, some drivers do not handle it well.
And further down that thread there was a guy mentioning this:
This is a very dirty workaround that bypasses PulseAudio's scheduling mechanisms in favor of the traditional interrupt approach. Use with caution.
But alas, now it seems to work for me. There seems to be slight delay in the playback of sound effects, but it's only by a few milliseconds and barely noticeable.

Re: [Solved] Sound and music distortion [Linux]

Posted: Sat Mar 19, 2016 7:58 am
by Koub
Nice to hear you can play now :).
Added solved tag to your topic's title, so that people who experience the same problem can find your workaround more easily. I guess it still needs some attention from the devs, maybe is there something to do to the game to make this workaround non-mandatory..

Re: [Solved] Sound and music distortion [Linux]

Posted: Mon Mar 21, 2016 8:23 pm
by zvezdaburya
Koub wrote:Nice to hear you can play now :).
Added solved tag to your topic's title, so that people who experience the same problem can find your workaround more easily. I guess it still needs some attention from the devs, maybe is there something to do to the game to make this workaround non-mandatory..
Thanks for adding the tag, I hope this can be of help to someone :) I wanna add that i have a soundblaster sound card installed, so that might cause drivers to be a bit wonky... or something. I dunno :S

Re: [Solved] Sound and music distortion [Linux]

Posted: Sun Apr 30, 2017 7:55 pm
by bluephoenix47
I ran into this same problem, and the solution in "Known issues" did not work for me. Thankfully, this solution did. Note that I also had to launch with

Code: Select all

padsp %command%
(in Steam)

Re: [Solved] Sound and music distortion [Linux]

Posted: Tue Aug 04, 2020 10:07 am
by portaloffreedom
I have the same problem for a while now and the `pasp %command%` fixes it mostly, but it makes the entire system crash after a while if I was hosting a multiplayer game. Very weird.

Using Archlinux