Backwall projection, solving the issues
January 3rd, 2023
I have a standard Linux Mint computer setup on the desk with a monitor and two loudspeakers for stereo sound. Nothing particular there, but I also have a projector sitting on a shelf in front of me throwing entertainment onto the back wall of the room, i.e. I face the other way when watching movies and series. For years I used a separate laptop for that purpose because there were some, possibly Nvidia driver stability issues with the main computer when using the projector with it.
Fast forward to 2023: let’s give it another try, especially as Mint 21’s video playback is no more smooth on the laptop. There are some random stutters that most likely have to do with compositing, but whatever the reason, they’re infuriating. On the main machine running Mint 20.3 there are no more crashes with the projector or switching the extended desktop on and off (it’s a nuisance if the projector is not in use) – some things seem to have improved over the years – and the video playback is flawless. However, there are three issues that needed solving:
- Always going to display preferences to turn extended desktop on or off is a clumsy, albeit small extra chore. Luckily xrandr works well for this, no need to use Nvidia’s proprietary settings.
- I’d like VLC to align videos to bottom on the projector to save my neck and center them on the main monitor. Some trickery with vlcrc settings solved this.
- Sound channels are the wrong way around, since I’m facing the other way. Some googling revealed a Pulseaudio hack which creates a new virtual sound device with reversed channels.
All these three were combined into a script called leffa.sh which accepts parameters on and off:
#!/bin/sh
SN="alsa_output.usb-Yamaha_Corporation_Steinberg_UR12-00.analog-stereo"
case $1 in
on)
xrandr --output HDMI-0 --auto --pos 2560x0
cat ~/.config/vlc/vlcrc | sed 's/#align=0/align=8/' >/tmp/nak
mv /tmp/nak ~/.config/vlc/vlcrc
pactl load-module module-remap-sink sink_name=reverse-stereo\
master=$SN channels=2 master_channel_map=front-right,front-left\
channel_map=front-left,front-right remix=no
pactl set-default-sink reverse-stereo
pactl set-sink-volume reverse-stereo "40%"
pactl set-sink-volume $SN "100%"
;;
off)
xrandr --output HDMI-0 --off
cat ~/.config/vlc/vlcrc | sed 's/^align=8/#align=0/' >/tmp/nak
mv /tmp/nak ~/.config/vlc/vlcrc
pactl unload-module module-remap-sink
pactl set-sink-volume $SN "40%"
pactl set-default-sink $SN
;;
*)
echo "Parameters on/off plz"
;;
esac
You will probably need to modify the Pulseaudio sink to fit your setup. To get the correct name try pactl list. Likewise, I’ve extended the desktop to the right upper corner of the 2560×1440 screen, which might not be what you want. As the final touch I created clickable icons for the Cinnamon panel, which run leffa.sh on or off:
So far I don’t have extensive experience with the reliability of the script, but at least quick testing seems to confirm its usefulness. Pulseaudio is often a bit shaky, so after a while it might need a restart. Likewise, constantly extending and unextending the desktop may eventually lead to trouble with either Nvidia or Cinnamon. I’ll let you know if there are issues in the long run. On the positive side, even Cinnamon’s workspace switcher seems to notice the change and update its shape accordingly – on the laptop it doesn’t, so it looks like Mint 21 still needs some fixing here and there. Another nice observation is that left/right remapping doesn’t seem to introduce any noticeable extra lag, and lipsync doesn’t deteriorate.
One thing that still needs thinking is volume control: the reverse-stereo sink has its own individual volume which is relative to the underlying actual sound card. In other words, you can’t crank the volume higher than what it was before the remap. I have a volume knob on the soundcard, but it’s not a good idea to amplify quiet signals with it. A quick “solution” is to simply turn the volume up before switching to the projector, but perhaps there’s a better way.
edit: Better use symbolic names for the Pulseaudio sinks. Furthermore, the volume issue is solved now by setting the main card volume to 100%, after which the virtual sink volume works as expected. Also removed the useless and potentially harmful sample rate remixing.
edit2: An easier way to discover the sink names: pactl list | grep “Name: alsa_output” | grep -v “.monitor”
Kommentin kirjoitus
You must be logged in to post a comment.
RSS feed for comments on this post.