Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Valheim on Linux keeps defaulting to the WRONG output device. Unplugging and replugging works because Pulse Audio wants to change audio streams over to new devices (this can be unset).
A better solution is to open PavuControl (avilable for all major distributions...it's an audio stream controller) and change Valheim (listed as FMOD Ex App...) to the correct sound device. If that sounds minorly cumbersome, well, it is. That said, grab PavuConrol anyways, it solves many issues, lets you easly change things to and from your headset, speakers, hdmi, controller speaker. Also, you can set an audio device default...but Valheim will not respect it.
Solution #2: We use Linux. Make a script!
First lets find our output devices:
<code># pactl list short sinks</code>
<code>50 alsa_output.usb-Sony_Interactive_Entertainment_DualSense_Wireless_Controller-00.analog-surround-40 PipeWire s16le 4ch 48000Hz IDLE
52 alsa_output.usb-sky_win_HS011_dongle_20221215185141-00.analog-stereo PipeWire s16le 2ch 48000Hz IDLE
54 alsa_output.pci-0000_04_01.0.analog-stereo PipeWire float32le 2ch 48000Hz IDLE</code>
Next lets find our audio streams (with Valheim Running):
<code># pactl list short sink-inputs</code>
<code>1230 50 1229 PipeWire s16le 2ch 48000Hz</code>
We can move Valheim over to the speakers with:
<b># pactl move-sink-input 1230 54</b>
But this is even MORE cumbersome!
Again, this is Linux, so lets use it!
We can use SED to extract the stream ID and we can use the device symbolic name (the device ID can change).
<code># pactl move-sink-input $(pactl list short sink-inputs | sed 's/\s.*$//') alsa_output.pci-0000_04_01.0.analog-stereo</code>
(Please use your won sound card...don;t play Valheim on MY sound card!)
This is good if only Valheim is outputting audio...not so good if you're playing music, chatting in Discord, have Firefox open with a paused YouTube video. Time for ONE more fix.
Make a new file (call it ValSound.sh or some such) and make it executable with chmod +x ValSound.sh and put it in your path (or include it's full path in the Steam launch options).
<code>
#!/bin/bash
# Set the name of your preferred soundcard for Valheim here!
# Get the name from "pactl list short sinks"
SOUNDCARD="alsa_output.pci-0000_04_01.0.analog-stereo"
# Put this file (and make it executable, chmod +x) in your path
# or specify it's location manualy.
# Change your Valheim launch options in steam to somthing like:
# %command% & (sleep 10; ValSound.sh)
# OR
# %command% -windowed +connect YourServer:2456 -console & (sleep 10; /home/MyUserName/ValSound.sh)
IFS=$'\n' read -rd '' -a array <<< "$(pactl list sink-inputs)"
COUNTER=0
for i in "${array[@]}"
do
#echo $COUNTER: $i
if [[ $i == *"FMOD Ex App"* ]]; then
#echo "$i"
f=$COUNTER
for (($f-1; f>=0; f--)); do
#echo $f
if [[ ${array[$f]} == *"Sink Input #"* ]]; then
VALHEIM=$(echo ${array[$f]} | sed 's/Sink Input #//')
#echo $VALHEIM
f=0
fi
done
fi
COUNTER=$((COUNTER + 1))
done
echo $VALHEIM $SOUNDCARD
pactl move-sink-input $VALHEIM $SOUNDCARD
</code>
Finally, change your Valheim launch options in steam to something like:
<b>%command% & (sleep 10; ValSound.sh)</b>
OR
<b>%command% -windowed +connect YourServer:2456 -console & (sleep 10; /home/MyUserName/ValSound.sh)</b>
10 seconds after Valheim is starts this will move it to the correct output device. You could also just execute the script manually.
This crazy thing took me like nearly 4 hours to get automated (and I'd been searching for a solution for an existing solution for sometime), so I truly hope it can help some of you guys.
Also, here's a link the the Valheim bug report: The Bug![valheimbugs.featureupvote.com] MaCarBre put up the Bug Report. Please go upvote it so they fix it.