{"id":135,"date":"2021-10-25T09:19:51","date_gmt":"2021-10-25T14:19:51","guid":{"rendered":"https:\/\/xkahn.zoned.net\/blog\/?p=135"},"modified":"2021-10-25T09:19:51","modified_gmt":"2021-10-25T14:19:51","slug":"multi-user-audio-with-pulseaudio","status":"publish","type":"post","link":"https:\/\/xkahn.zoned.net\/blog\/2021\/10\/25\/multi-user-audio-with-pulseaudio\/","title":{"rendered":"Multi-user audio with Pulseaudio"},"content":{"rendered":"\n<p>I&#8217;ve been trying to solve this problem for a long while and never figured it out &#8212; even after reading lots of posts with the correct solution. <\/p>\n\n\n\n<p>Now that I&#8217;ve finally figured it out, I&#8217;m writing it down here so I can find the solution later. (And maybe it&#8217;ll help someone else&#8230;)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using audio on Linux with multiple simultaneous users<\/h2>\n\n\n\n<p>Wait&#8230; What? Why? <\/p>\n\n\n\n<p>My typical usage of my Linux desktop is single user. Your usage is likely the same. Why would you even want to use multiple users at the same time?<\/p>\n\n\n\n<p>There are a number of reasons you might want to do this, but I often test software on my machine without using a container or a VM. I do this by creating a new user account and either using <code>su<\/code> or <code>ssh<\/code> to switch users.<\/p>\n\n\n\n<p><a href=\"https:\/\/forums.gentoo.org\/viewtopic-t-1110600-start-0.html\" target=\"_blank\" rel=\"noreferrer noopener\">This post details the basics on how to do this.<\/a><\/p>\n\n\n\n<p>But here are the real details with emphasis on the part I missed:<\/p>\n\n\n\n<p>In <strong>\/etc\/pulse\/default.pa<\/strong> find a line that says <code>load-module module-native-protocol-unix<\/code><\/p>\n\n\n\n<p>On my machine, this line is part of a block that looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-cyan-bluish-gray-background-color has-background\">### Load several protocols\n.ifexists module-esound-protocol-unix.so\nload-module module-esound-protocol-unix\n.endif\nload-module module-native-protocol-unix\n<\/pre>\n\n\n\n<p>Change that line to say: <code>load-module module-native-protocol-unix auth-anonymous=1 socket=\/tmp\/pulse-socket<\/code><\/p>\n\n\n\n<p>It should now look like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-cyan-bluish-gray-background-color has-background\">### Load several protocols\n.ifexists module-esound-protocol-unix.so\nload-module module-esound-protocol-unix\n.endif\nload-module module-native-protocol-unix auth-anonymous=1 socket=\/tmp\/pulse-socket\n<\/pre>\n\n\n\n<p>Now edit <strong>\/etc\/pulse\/client.conf<\/strong> and add this line: <code>default-server = unix:\/tmp\/pulse-socket<\/code><\/p>\n\n\n\n<p><strong>The above steps will make pulseaudio multiuser, but will <em>ALSO<\/em> have the effect of stopping pulseaudio from starting correctly. Now we need to fix that.<\/strong><\/p>\n\n\n\n<p>Create a new file called <strong>~\/.config\/autostart\/pulseaudio.desktop<\/strong> and insert:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-cyan-bluish-gray-background-color has-background\">[Desktop Entry]\nVersion=1.0\nName=PulseAudio\nGenericName=Soundi Server\nComment=Start the Sound Server\nExec=pulseaudio -D\nTerminal=false\nType=Application\n<\/pre>\n\n\n\n<p>You should restart pulseaudio after these changes. The easiest way is to log out and log back in. (But you can also kill the process by running <code>pulseaudio --kill; pulseaudio -D<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been trying to solve this problem for a long while and never figured it out &#8212; even after reading lots of posts with the correct solution. Now that I&#8217;ve finally figured it out, I&#8217;m writing it down here so I can find the solution later. (And maybe it&#8217;ll help someone else&#8230;) Using audio on\u2026 <span class=\"read-more\"><a href=\"https:\/\/xkahn.zoned.net\/blog\/2021\/10\/25\/multi-user-audio-with-pulseaudio\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-135","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/posts\/135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/comments?post=135"}],"version-history":[{"count":1,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":136,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/posts\/135\/revisions\/136"}],"wp:attachment":[{"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/media?parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/categories?post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xkahn.zoned.net\/blog\/wp-json\/wp\/v2\/tags?post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}