toadjaune / pulseaudio-config

Scripts and notes for custom pulseaudio configuration
GNU Affero General Public License v3.0
239 stars 28 forks source link

Could somebody help adapt this for Pipewire? #16

Open matthewhm opened 1 month ago

matthewhm commented 1 month ago

I have found this script very useful. On upgrading to Linux Mint 22 this month which is using Pipewire, I get an error No PulseAudio daemon running, or not running as session daemon then ERROR: Microphone (source) "alsa_input.pci-0000_00_0e.0.analog-stereo" was not found

which I think comes from the fact that the pacmd commands are not supported by Pipewire. I have tried replacing them with pactl commands using this chart https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Migrate-PulseAudio#pacmd but I am still getting ERROR: Microphone (source) "alsa_input.pci-0000_00_0e.0.analog-stereo" was not found, probably because the rest of the line needs to be adapted and I don't know how to do that.

If I comment out lines 19 to 27 then the script works perfectly without errors as before, but how would I adapt the script without commenting out? I am a beginner to using scripts so simple or step-by-step answers would be appreciated.

toadjaune commented 6 days ago

Indeed, it looks like pacmd doesn't work with pipewire. It's probably possible to replace it directly with pactl to get similar functionality.

Lines 19 to 27 are only sanity checks though ; they aren't required, they're only used to inform the user if something is wrong with the device names. So, commenting them out as you did should be fine as a workaround.

If you want to attempt fixing them properly, in a portable way ; I'd attempt replacing the pacmd command with pactl, a quick search seems to indicate that the equivalent commands would be :

Since the output format of those commands is slightly different, you'd need to adapt the grep filtering so that the test is considered valid only when the configured device actually exists, and errors out otherwise (as is currently the case). Considering the new format, I'd probably switch from grep to awk