You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the default audio script the mic doesn't always work. I believe that this is because it is running too fast. I modified the script with some "sleep 1" and now it works 100% of the time for me.
SteamVR Version:
2.5.5 Install Type:
package manager runtime version not native
Attached is the updated working audio script.
#!/bin/bash# Set either to 0 to prevent from creating audio or microphone sinks and instead you using own headset or microphone
USE_HEADSET_AUDIO=1
USE_HEADSET_MIC=1
functionget_playback_sink_input_id() {
get_playback_id sink-inputs 'Sink Input'"$1"
}
functionget_playback_source_output_id() {
get_playback_id source-outputs 'Source Output'"$1"
}
functionget_playback_id() {
local last_node_name=''local last_node_id=''
pactl list "$1"|whileread -r line;do
node_id=$(echo "$line"| grep -oP "$2 #\K.+"| sed -e 's/^[ \t]*//')
node_name=$(echo "$line"| grep -oP 'node.name = "\K[^"]+'| sed -e 's/^[ \t]*//')if [[ "$node_id"!='' ]] && [[ "$last_node_id"!="$node_id" ]];then
last_node_id="$node_id"fiif [[ -n"$node_name" ]] && [[ "$last_node_name"!="$node_name" ]];then
last_node_name="$node_name"if [[ "$last_node_name"=="$3" ]];thenecho"$last_node_id"returnfifidone
}
functionget_sink_id_by_name() {
local sink_name
sink_name=$1
pactl list short sinks | grep "$sink_name"| cut -d$'\t' -f1
}
functionsetup_mic() {
if [[ $USE_HEADSET_MIC== 1 ]];thenecho"Creating microphone sink & source and linking alvr playback to it"# This sink is required so that it persistently auto-connects to alvr playback later
pactl load-module module-null-sink sink_name=ALVR-MIC-Sink media.class=Audio/Sink | tee -a "$XDG_RUNTIME_DIR"/alvr-audio
# This source is required so that any app can use it as microphone
pactl load-module module-null-sink sink_name=ALVR-MIC-Source media.class=Audio/Source/Virtual | tee -a "$XDG_RUNTIME_DIR"/alvr-audio
# We link them together
pw-link ALVR-MIC-Sink:monitor_FL ALVR-MIC-Source:input_FL
pw-link ALVR-MIC-Sink:monitor_FR ALVR-MIC-Source:input_FR
# And we assign playback of pipewire alsa playback to created alvr sink
pactl move-sink-input "$(get_playback_sink_input_id alsa_playback.vrserver)""$(get_sink_id_by_name ALVR-MIC-Sink)"
pactl set-default-source ALVR-MIC-Source
fi
}
functionunload_modules() {
echo"Unloading audio, microphone sink & source"whileread -r line;do
pactl unload-module "$line"done<""$XDG_RUNTIME_DIR"/alvr-audio">"$XDG_RUNTIME_DIR"/alvr-audio
}
functionsetup_audio() {
if [[ $USE_HEADSET_AUDIO== 1 ]];thenecho"Setting up audio"
pactl load-module module-null-sink sink_name=ALVR-AUDIO-Sink media.class=Audio/Sink | tee -a "$XDG_RUNTIME_DIR"/alvr-audio
pactl set-default-sink ALVR-AUDIO-Sink
pactl move-source-output "$(get_playback_source_output_id alsa_capture.vrserver)""$(get_sink_id_by_name ALVR-AUDIO-Sink)"fi
}
case$ACTIONin
connect)
unload_modules
sleep 1
setup_mic
setup_audio
;;
disconnect)
unload_modules
;;
esac
The text was updated successfully, but these errors were encountered:
Description
Using the default audio script the mic doesn't always work. I believe that this is because it is running too fast. I modified the script with some "sleep 1" and now it works 100% of the time for me.
Environment
Gentoo Linux Steam VR
Hardware
CPU:
5950x
GPU:
6900xt
GPU Driver Version:
mesa-24.1.0
Audio:
pipewire/pulseaudio
Installation
ALVR Version:
20.8.1
ALVR Settings File:
SteamVR Version:
2.5.5
Install Type:
package manager runtime version not native
Attached is the updated working audio script.
The text was updated successfully, but these errors were encountered: