{"id":7319,"date":"2023-01-03T14:41:34","date_gmt":"2023-01-03T12:41:34","guid":{"rendered":"http:\/\/www.kameli.net\/marq\/?p=7319"},"modified":"2023-01-03T18:49:37","modified_gmt":"2023-01-03T16:49:37","slug":"backwall-projection-solving-the-issues","status":"publish","type":"post","link":"http:\/\/www.kameli.net\/marq\/?p=7319","title":{"rendered":"Backwall projection, solving the issues"},"content":{"rendered":"\n<p>I have a standard <em>Linux Mint<\/em> 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.<\/p>\n\n\n\n<p>Fast forward to 2023: let&#8217;s give it another try, especially as <em>Mint<\/em> 21&#8217;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&#8217;re infuriating. On the main machine running <em>Mint<\/em> 20.3 there are no more crashes with the projector or switching the extended desktop on and off (it&#8217;s a nuisance if the projector is not in use) \u2013&nbsp;some things seem to have improved over the years \u2013 and the video playback is flawless. However, there are three issues that needed solving:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Always going to display preferences to turn extended desktop on or off is a clumsy, albeit small extra chore. Luckily <em>xrandr<\/em> works well for this, no need to use Nvidia&#8217;s proprietary settings.<\/li>\n\n\n\n<li>I&#8217;d like <em>VLC<\/em> 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.<\/li>\n\n\n\n<li>Sound channels are the wrong way around, since I&#8217;m facing the other way. Some googling revealed a <em>Pulseaudio<\/em> hack which creates a new virtual sound device with reversed channels.<\/li>\n<\/ol>\n\n\n\n<p>All these three were combined into a script called <em>leffa.sh<\/em> which accepts parameters <em>on<\/em> and <em>off<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\n\nSN=\"alsa_output.usb-Yamaha_Corporation_Steinberg_UR12-00.analog-stereo\"\n\ncase $1 in\n\n        on)\n                xrandr --output HDMI-0 --auto --pos 2560x0\n                cat ~\/.config\/vlc\/vlcrc | sed 's\/#align=0\/align=8\/' &gt;\/tmp\/nak\n                mv \/tmp\/nak ~\/.config\/vlc\/vlcrc\n                pactl load-module module-remap-sink sink_name=reverse-stereo\\\n                master=$SN channels=2 master_channel_map=front-right,front-left\\\n                channel_map=front-left,front-right remix=no\n                pactl set-default-sink reverse-stereo\n                pactl set-sink-volume reverse-stereo \"40%\"\n                pactl set-sink-volume $SN \"100%\"\n        ;;\n\n        off)\n                xrandr --output HDMI-0 --off\n                cat ~\/.config\/vlc\/vlcrc | sed 's\/^align=8\/#align=0\/' &gt;\/tmp\/nak\n                mv \/tmp\/nak ~\/.config\/vlc\/vlcrc\n                pactl unload-module module-remap-sink\n                pactl set-sink-volume $SN \"40%\"\n                pactl set-default-sink $SN  \n        ;;\n\n        *)\n                echo \"Parameters on\/off plz\"\n        ;;\n\nesac<\/code><\/pre>\n\n\n\n<p>You will probably need to modify the <em>Pulseaudio<\/em> sink to fit your setup. To get the correct name try <em>pactl list<\/em>. Likewise, I&#8217;ve extended the desktop to the right upper corner of the 2560&#215;1440 screen, which might not be what you want. As the final touch I created clickable icons for the <em>Cinnamon<\/em> panel, which run <em>leffa.sh on<\/em> or <em>off<\/em>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"http:\/\/www.kameli.net\/marq\/wp-content\/uploads\/2023\/01\/icons.png\"><img loading=\"lazy\" decoding=\"async\" width=\"118\" height=\"40\" src=\"http:\/\/www.kameli.net\/marq\/wp-content\/uploads\/2023\/01\/icons.png\" alt=\"\" class=\"wp-image-7320\"\/><\/a><figcaption class=\"wp-element-caption\">Click click.<\/figcaption><\/figure>\n<\/div>\n\n\n<p>So far I don&#8217;t have extensive experience with the reliability of the script, but at least quick testing seems to confirm its usefulness. <em>Pulseaudio<\/em> 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 <em>Cinnamon<\/em>. I&#8217;ll let you know if there are issues in the long run. On the positive side, even <em>Cinnamon&#8217;s<\/em> workspace switcher seems to notice the change and update its shape accordingly \u2013&nbsp;on the laptop it doesn&#8217;t, so it looks like <em>Mint<\/em> 21 still needs some fixing here and there. Another nice observation is that left\/right remapping doesn&#8217;t seem to introduce any noticeable extra lag, and lipsync doesn&#8217;t deteriorate.<\/p>\n\n\n\n<p>One thing that still needs thinking is volume control: the <em>reverse-stereo<\/em> sink has its own individual volume which is relative to the underlying actual sound card. In other words, you can&#8217;t crank the volume higher than what it was before the remap. I have a volume knob on the soundcard, but it&#8217;s not a good idea to amplify quiet signals with it. A quick &#8220;solution&#8221; is to simply turn the volume up before switching to the projector, but perhaps there&#8217;s a better way.<\/p>\n\n\n\n<p><em>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.<\/em> <em>Also removed the useless and potentially harmful sample rate remixing.<\/em><\/p>\n\n\n\n<p><em>edit2: An easier way to discover the sink names: pactl list | grep &#8220;Name: alsa_output&#8221; | grep -v &#8220;.monitor&#8221;<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,22,13],"tags":[],"class_list":["post-7319","post","type-post","status-publish","format-standard","hentry","category-koodi","category-laitteet","category-linux"],"_links":{"self":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/7319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7319"}],"version-history":[{"count":8,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/7319\/revisions"}],"predecessor-version":[{"id":7330,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/7319\/revisions\/7330"}],"wp:attachment":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7319"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}